:root {
  --bg: #f5f8fd;
  --card: rgba(255, 255, 255, 0.96);
  --border: #dbe4f3;
  --border-soft: #e8eef7;
  --text: #0d1b3f;
  --muted: #60708f;
  --blue: #2563eb;
  --blue-soft: #edf4ff;
  --green: #12b76a;
  --green-soft: #e8fff3;
  --purple: #7c3aed;
  --purple-soft: #f3edff;
  --orange: #f97316;
  --orange-soft: #fff4e8;
  --red: #ef4444;
  --shadow: 0 16px 38px rgba(29, 56, 107, 0.08);
  --radius: 20px;
  --side: clamp(14px, 3vw, 36px);
  --page-max: 1600px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .10), transparent 34rem),
    radial-gradient(circle at top right, rgba(124, 58, 237, .10), transparent 36rem),
    linear-gradient(180deg, #fbfdff 0%, #f5f8fd 45%, #f7f9fc 100%);
}

.app-shell {
  width: min(var(--page-max), calc(100vw - var(--side) * 2));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand status"
    "search search";
  gap: 14px 20px;
  align-items: center;
  margin-bottom: 14px;
}

.brand-block { grid-area: brand; display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 14px 22px rgba(37, 99, 235, 0.25);
  flex: 0 0 46px;
}
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 11px; letter-spacing: .12em; font-weight: 800; }
h1 { margin: 0; font-size: clamp(24px, 2vw, 30px); letter-spacing: -0.04em; }

.search-panel {
  grid-area: search;
  display: grid;
  grid-template-columns: minmax(136px, 170px) minmax(260px, 1fr) 96px 82px;
  gap: 12px;
  align-items: end;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255,255,255,.84);
  box-shadow: 0 16px 42px rgba(29, 56, 107, 0.08);
  backdrop-filter: blur(16px);
}
.search-panel label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.search-panel label > span { color: var(--muted); font-size: 12px; font-weight: 800; }
select,
input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid #cfd9ea;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 0 14px;
  font-size: 14px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
select:focus,
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.primary-button,
.ghost-button {
  height: 42px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.primary-button { color: #fff; background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 10px 22px rgba(37, 99, 235, .22); }
.ghost-button { color: #24416f; background: #edf3ff; }
.primary-button:hover,
.ghost-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }

.update-meta {
  grid-area: status;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  min-width: 0;
}
.pulse-dot { width: 9px; height: 9px; border-radius: 999px; background: #94a3b8; box-shadow: 0 0 0 5px rgba(148, 163, 184, .15); flex: 0 0 auto; }
.is-loaded .pulse-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(18, 183, 106, .14); }
.is-error .pulse-dot { background: var(--red); box-shadow: 0 0 0 5px rgba(239, 68, 68, .14); }

.notice-bar {
  border: 1px solid #d9e6ff;
  border-radius: 16px;
  background: linear-gradient(90deg, #eff6ff, #fff);
  color: #315077;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.65;
}
.notice-bar.is-hidden { display: none; }

.card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-hero {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: clamp(18px, 2vw, 30px);
  padding: clamp(18px, 2vw, 28px);
  margin-bottom: 18px;
}
.profile-left { display: flex; gap: 22px; align-items: center; border-right: 1px solid #e2e8f0; padding-right: clamp(18px, 2vw, 28px); min-width: 0; }
.avatar-wrap {
  width: 100px;
  height: 100px;
  flex: 0 0 100px;
  border-radius: 28px;
  overflow: hidden;
  border: 4px solid #fff;
  background: #dbeafe;
  box-shadow: 0 16px 26px rgba(15, 23, 42, 0.13);
}
.avatar-wrap img { display: block; width: 100px; height: 100px; object-fit: cover; }
.avatar-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-size: 34px; font-weight: 900; background: linear-gradient(135deg, #cbd5e1, #94a3b8); }
.is-empty .avatar-wrap,
.is-loading .avatar-wrap { filter: blur(5px); opacity: .72; }
.profile-title { min-width: 0; }
.profile-title h2 { margin: 0; font-size: clamp(22px, 2vw, 27px); letter-spacing: -0.04em; overflow-wrap: anywhere; }
.profile-title p { margin: 8px 0 12px; color: #294469; font-size: 16px; overflow-wrap: anywhere; }
.name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #eff4ff;
  color: #25406c;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.badge-green { background: var(--green-soft); color: #069653; }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; min-width: 0; }
.hero-item {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.72);
}
.hero-item span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 7px; line-height: 1.4; }
.hero-item strong { display: block; min-height: 22px; font-size: 14px; overflow-wrap: anywhere; line-height: 1.45; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: -0.02em; }
.state-good { color: var(--green); }
.state-risk { color: var(--orange); }
.state-purple { color: var(--purple); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.metric-card,
.health-card { padding: 20px; min-height: 166px; min-width: 0; }
.metric-heading { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; }
.metric-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 14px; background: var(--blue-soft); font-size: 20px; flex: 0 0 auto; }
.metric-purple .metric-icon { background: var(--purple-soft); }
.metric-orange .metric-icon { background: var(--orange-soft); }
.metric-main { display: block; margin-top: 16px; font-size: clamp(28px, 2.5vw, 35px); line-height: 1; color: var(--blue); letter-spacing: -0.04em; overflow-wrap: anywhere; }
.metric-purple .metric-main { color: var(--purple); }
.metric-orange .metric-main { color: var(--orange); }
.metric-card > span { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }
.metric-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.metric-split div + div { border-left: 1px solid #e2e8f0; padding-left: 12px; }
.metric-split b { display: block; font-size: clamp(17px, 1.4vw, 21px); color: var(--text); margin-bottom: 5px; overflow-wrap: anywhere; }
.metric-split span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.health-content { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 16px; }
.ring {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) 0deg, var(--green) var(--health-deg, 0deg), #e5edf7 var(--health-deg, 0deg), #e5edf7 360deg);
  position: relative;
}
.ring::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px #edf2f7; }
.ring span,
.ring small { z-index: 1; }
.ring span { font-weight: 900; font-size: 24px; }
.ring small { color: var(--muted); font-size: 12px; margin-top: 30px; position: absolute; }
.health-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.health-list li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.health-list b { color: var(--text); overflow-wrap: anywhere; text-align: right; }

.sections-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
.detail-section { overflow: hidden; min-width: 0; }
.section-title { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid #e2e8f0; }
.section-title span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 12px; font-weight: 900; color: var(--blue); background: var(--blue-soft); flex: 0 0 32px; }
.section-title h3 { margin: 0; font-size: 17px; }
.section-buyer .section-title span { color: var(--green); background: var(--green-soft); }
.section-seller .section-title span { color: var(--purple); background: var(--purple-soft); }
.section-risk .section-title span { color: var(--orange); background: var(--orange-soft); }
.section-risk { border-color: #fed7aa; }
.section-risk .section-title { background: linear-gradient(90deg, #fff7ed, rgba(255,255,255,.9)); }
.section-seller .section-title { background: linear-gradient(90deg, #f5f3ff, rgba(255,255,255,.9)); }
.section-buyer .section-title { background: linear-gradient(90deg, #ecfdf5, rgba(255,255,255,.9)); }
.section-account .section-title { background: linear-gradient(90deg, #eff6ff, rgba(255,255,255,.9)); }

.field-grid {
  padding: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}
.section-account .field-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.section-buyer .field-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.section-seller .field-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.section-risk .field-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.field-row {
  min-width: 0;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.72);
}
.field-row dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.field-row dd {
  margin: 0;
  text-align: left;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.42;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.field-row.is-important dd { color: var(--blue); font-size: 15px; }
.section-buyer .field-row.is-important dd { color: var(--green); }
.section-seller .field-row.is-important dd { color: var(--purple); }
.section-risk .field-row.is-important dd { color: var(--orange); }

.maskable { transition: filter .2s ease, opacity .2s ease; }
.is-empty .maskable,
.is-loading .maskable {
  filter: blur(5px);
  opacity: .55;
  user-select: none;
}
.is-empty .maskable::selection,
.is-loading .maskable::selection { background: transparent; }
.is-empty .ring { --health-deg: 0deg; filter: blur(3px); opacity: .65; }
.loading-shimmer { position: relative; overflow: hidden; }
.loading-shimmer::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  animation: shimmer 1.1s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

@media (min-width: 1400px) {
  .field-grid { grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); }
  .section-account .field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .section-buyer .field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .section-seller .field-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .section-risk .field-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr; grid-template-areas: "brand" "status" "search"; }
  .update-meta { justify-content: flex-start; white-space: normal; }
  .search-panel { grid-template-columns: minmax(130px, 160px) minmax(240px, 1fr) 90px 78px; }
  .profile-hero { grid-template-columns: 1fr; }
  .profile-left { border-right: 0; border-bottom: 1px solid #e2e8f0; padding-right: 0; padding-bottom: 20px; }
  .hero-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

@media (max-width: 720px) {
  :root { --side: 11px; }
  .app-shell { padding-top: 14px; }
  .brand-block { align-items: flex-start; }
  .logo-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .eyebrow { font-size: 10px; }
  .search-panel { grid-template-columns: 1fr; }
  .notice-bar { font-size: 13px; }
  .profile-hero { padding: 16px; }
  .profile-left { align-items: flex-start; flex-direction: column; gap: 16px; }
  .avatar-wrap { border-radius: 24px; }
  .hero-grid,
  .summary-grid,
  .field-grid,
  .section-account .field-grid,
  .section-buyer .field-grid,
  .section-seller .field-grid,
  .section-risk .field-grid { grid-template-columns: 1fr; }
  .health-content { grid-template-columns: 1fr; justify-items: start; }
  .health-list { width: 100%; }
  .metric-split { grid-template-columns: 1fr; }
  .metric-split div + div { border-left: 0; border-top: 1px solid #e2e8f0; padding-left: 0; padding-top: 12px; }
  .section-title { padding: 14px; }
  .field-grid { padding: 12px; gap: 10px; }
  .field-row { min-height: auto; padding: 11px 12px; }
}

@media (max-width: 380px) {
  .app-shell { width: calc(100vw - 16px); }
  .health-list li { flex-direction: column; gap: 2px; }
  .health-list b { text-align: left; }
}
