:root {
  color-scheme: light;
  --ink: #201a17;
  --muted: #756b63;
  --line: #eadfd3;
  --page: #fff7ed;
  --panel: #ffffff;
  --panel-soft: #fffaf4;
  --navy: #2b211b;
  --navy-2: #4a3427;
  --green: #c65a12;
  --green-soft: #fff3e3;
  --blue: #2f63b7;
  --amber: #e27614;
  --rose: #bd3f1d;
  --violet: #8a5a24;
  --teal: #16756f;
  --red: #b42318;
  --shadow: 0 26px 76px rgba(124, 64, 18, 0.16);
  --glow: 0 18px 40px rgba(226, 118, 20, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(198, 90, 18, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(198, 90, 18, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 237, 213, 0.72)),
    var(--page);
  background-size: 26px 26px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.terminal {
  position: relative;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  min-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid rgba(198, 90, 18, 0.18);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.terminal::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, #f97316, #facc15, transparent);
  animation: headerSweep 4.5s linear infinite;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 237, 0.92)),
    #ffffff;
  color: var(--ink);
  border-right: 1px solid rgba(198, 90, 18, 0.14);
}

.brand-block {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(226, 118, 20, 0.28);
  border-radius: 8px;
  background: linear-gradient(145deg, #fff7ed, #fed7aa);
  color: #9a3412;
  box-shadow: var(--glow);
  font-weight: 950;
}

.eyebrow {
  margin: 0 0 6px;
  color: currentColor;
  opacity: 0.66;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 23px;
  line-height: 1.25;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 17px;
}

.live-strip {
  position: relative;
  display: grid;
  grid-template-columns: 12px auto;
  gap: 8px 10px;
  align-items: center;
  padding: 14px 16px;
  overflow: hidden;
  border: 1px solid rgba(226, 118, 20, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.96), rgba(255, 255, 255, 0.94));
  box-shadow: 0 10px 28px rgba(124, 64, 18, 0.08);
}

.live-strip::after {
  content: "";
  position: absolute;
  inset: auto 16px 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #fb923c, transparent);
  animation: scanLine 2.8s linear infinite;
}

.live-strip span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.62);
  animation: pulseDot 1.8s ease-out infinite;
}

.live-strip strong {
  font-size: 14px;
}

.live-strip em {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.kyc-form,
.method-card {
  display: grid;
  gap: 16px;
}

.method-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(226, 118, 20, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #fff7ed);
  box-shadow: 0 12px 30px rgba(124, 64, 18, 0.08);
}

.method-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.section-title span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  border-radius: 6px;
  background: #ffedd5;
  color: #c2410c;
  font-size: 12px;
  font-weight: 950;
}

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

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

select {
  width: 100%;
  min-height: 48px;
  padding: 0 42px 0 13px;
  border: 1px solid #f2d4b7;
  border-radius: 8px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #ea580c 50%) right 18px center / 7px 7px no-repeat,
    linear-gradient(180deg, #ffffff, #fff8f1);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

select:hover {
  border-color: rgba(249, 115, 22, 0.62);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(124, 64, 18, 0.08);
}

select option {
  color: var(--ink);
  background: #ffffff;
}

select:focus,
button:focus {
  outline: 3px solid rgba(251, 146, 60, 0.28);
  outline-offset: 2px;
}

.primary-action,
.ghost-action {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  position: relative;
  min-height: 50px;
  margin-top: 4px;
  overflow: hidden;
  background: linear-gradient(135deg, #f97316, #c2410c);
  color: white;
  box-shadow: 0 14px 30px rgba(194, 65, 12, 0.28);
}

.primary-action::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 34%, rgba(255, 255, 255, 0.28) 46%, transparent 58% 100%);
  transform: translateX(-120%);
}

.primary-action:hover::after {
  animation: actionSweep 900ms ease;
}

.ghost-action {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #c2410c;
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 30px 32px;
  background:
    linear-gradient(180deg, rgba(255, 247, 237, 0.38), rgba(255, 255, 255, 0.95) 180px),
    var(--panel);
}

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

.status-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  min-width: 86px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff3e3;
  color: #c2410c;
  text-align: center;
  font-size: 13px;
  font-weight: 950;
}

#totalWeight {
  color: var(--navy);
  font-size: 30px;
  line-height: 1;
}

.summary-strip {
  padding: 16px 18px;
  border: 1px solid #fed7aa;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #fff7ed;
  color: #5f2f14;
  line-height: 1.7;
  animation: fadeRise 380ms ease both;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.chart-panel,
.metrics-panel article,
.diagnostic-card,
.allocation-table,
.constraints-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
}

.chart-panel {
  display: grid;
  gap: 16px;
  place-items: center;
  min-height: 300px;
  padding: 20px;
}

.donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.donut-wrap::before {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  border: 1px dashed rgba(249, 115, 22, 0.38);
  border-radius: 50%;
  animation: rotateRing 18s linear infinite;
}

.donut {
  display: grid;
  place-items: center;
  width: 198px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg 360deg);
  transform: rotate(-90deg);
  transition: background 420ms ease;
}

.donut.donut-shift {
  animation: donutShift 760ms cubic-bezier(0.22, 1, 0.36, 1);
}

.donut-core {
  display: grid;
  place-items: center;
  width: 122px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line), 0 12px 28px rgba(124, 64, 18, 0.1);
  transform: rotate(90deg);
}

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

.donut-core strong {
  color: var(--navy);
  font-size: 29px;
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.legend-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.metrics-panel article {
  display: grid;
  align-content: center;
  min-height: 138px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(124, 64, 18, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.metrics-panel article:hover,
.diagnostic-card:hover,
.asset-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(124, 64, 18, 0.13);
}

.metrics-panel span,
.diagnostic-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.metrics-panel strong {
  margin-top: 8px;
  color: var(--navy);
  font-size: 26px;
}

.metrics-panel small,
.diagnostic-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.diagnostic-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(124, 64, 18, 0.06);
}

.diagnostic-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--green);
}

.diagnostic-card strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 18px;
}

.allocation-table,
.constraints-panel {
  padding: 20px;
}

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

.table-heading span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.bars {
  display: grid;
  gap: 10px;
}

.asset-row {
  display: grid;
  grid-template-columns: minmax(170px, 250px) minmax(0, 1fr) 62px;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid #f0dfcf;
  border-radius: 8px;
  background: #ffffff;
  transition: transform 180ms ease, box-shadow 180ms ease;
  animation: fadeRise 420ms ease both;
}

.asset-name {
  color: var(--navy);
  font-weight: 950;
  line-height: 1.35;
}

.asset-desc {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #f4e7da;
}

.fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.weight {
  text-align: right;
  color: var(--navy);
  font-size: 18px;
  font-weight: 950;
}

.rationale {
  grid-column: 2 / 4;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.rationale-hidden .rationale {
  display: none;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  padding: 13px 14px 13px 42px;
  border: 1px solid #f0dfcf;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  line-height: 1.55;
  animation: fadeRise 420ms ease both;
}

.timeline li::before {
  content: attr(data-step);
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--green);
  color: #ffffff;
  font-size: 11px;
  font-weight: 950;
}

.error {
  border-color: #fecdca;
  border-left-color: var(--red);
  background: #fff4f2;
  color: var(--red);
}

@keyframes pulseDot {
  0% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.58);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
  }
}

@keyframes headerSweep {
  from {
    transform: translateX(-65%);
  }
  to {
    transform: translateX(65%);
  }
}

@keyframes scanLine {
  from {
    transform: translateX(-80%);
  }
  to {
    transform: translateX(80%);
  }
}

@keyframes actionSweep {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(120%);
  }
}

@keyframes rotateRing {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes donutShift {
  0% {
    filter: saturate(1);
    scale: 1;
  }
  42% {
    filter: saturate(1.12) brightness(1.05);
    scale: 1.035;
  }
  100% {
    filter: saturate(1);
    scale: 1;
  }
}

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

  .dashboard-grid,
  .diagnostics {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1440px);
    padding: 10px 0;
  }

  .sidebar,
  .main-panel {
    padding: 20px;
  }

  .panel-header,
  .table-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-grid,
  .diagnostics,
  .metrics-panel {
    grid-template-columns: 1fr;
  }

  .asset-row {
    grid-template-columns: 1fr 58px;
  }

  .asset-desc,
  .track {
    grid-column: 1 / 3;
  }

  .track {
    grid-row: 3;
  }

  .rationale {
    grid-column: 1 / 3;
  }
}
