:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --surface: #f7f8fa;
  --surface-strong: #eef1f4;
  --line: #e6e9ed;
  --text: #1f2329;
  --muted: #747b87;
  --accent: #1677ff;
  --accent-hover: #0f68e8;
  --success: #1f9d62;
  --warning: #d9780d;
  --danger: #d84a4a;
  --shadow: 0 8px 28px rgba(30, 45, 65, 0.08);
  --font-sans: "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", sans-serif;
}

body[data-theme="dark"] {
  --bg: #14171b;
  --panel: #1d2127;
  --surface: #252a31;
  --surface-strong: #2c323a;
  --line: #343a43;
  --text: #f1f3f5;
  --muted: #a5acb7;
  --accent: #4c96ff;
  --accent-hover: #68a7ff;
  --success: #55c98c;
  --warning: #f0a44d;
  --danger: #ef7777;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  min-height: 100vh;
  padding: 24px 16px;
}

.app-card {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

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

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

.topbar h1 {
  margin: 0;
  overflow: hidden;
  font-size: 19px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.theme-toggle,
.back-link {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.theme-toggle:hover,
.back-link:hover {
  border-color: var(--accent);
}

.hero {
  padding-top: 22px;
}

.intro-copy {
  margin-bottom: 16px;
}

.intro-copy h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
}

.intro-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

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

.search-panel,
.result-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-panel {
  min-width: 0;
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.step-number {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.section-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.input-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

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

.search-row input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.search-row input:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.search-row button {
  min-width: 94px;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.search-row button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.search-row button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.helper-text {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.quick-actions,
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.chip {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

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

.card-meta span,
.status-pill,
.level-badge,
.service-chip {
  display: inline-flex;
  align-items: center;
}

.card-meta span {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.result-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.result-toolbar .back-link {
  justify-self: start;
}

.result-toolbar .theme-toggle {
  justify-self: end;
}

.toolbar-title {
  font-size: 15px;
  font-weight: 700;
}

.notice-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--line));
  border-left: 4px solid var(--warning);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warning) 7%, var(--panel));
}

.notice-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-weight: 800;
}

.notice-label {
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
}

.notice-copy h2 {
  margin: 2px 0 0;
  font-size: 16px;
  line-height: 1.4;
}

.notice-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.result-wrap {
  margin-top: 16px;
  padding: 18px;
}

.result-page-wrap {
  border: 0;
  padding: 18px 0 0;
}

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

.result-header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}

.result-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.status-pill.is-ready {
  background: color-mix(in srgb, var(--success) 12%, var(--panel));
  color: var(--success);
}

.status-pill.is-loading {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent);
}

.status-pill.is-missing {
  background: color-mix(in srgb, var(--warning) 12%, var(--panel));
  color: var(--warning);
}

.result-card-meta {
  margin: 0 0 12px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  padding: 24px;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.empty-state h3 {
  margin: 12px 0 4px;
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.profile-card {
  display: grid;
  gap: 12px;
}

.hidden {
  display: none;
}

.identity-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border-radius: 8px;
  background: #1677ff;
  color: #fff;
}

.avatar {
  width: 80px;
  height: 80px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #dfe8f5;
}

.avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.identity-content {
  min-width: 0;
}

.identity-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.identity-name {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 23px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-badge {
  flex: 0 0 auto;
  min-height: 23px;
  padding: 0 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 700;
}

.identity-account {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  line-height: 1.45;
}

.identity-sub {
  margin: 8px 0 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.identity-facts span + span {
  position: relative;
  padding-left: 10px;
}

.identity-facts span + span::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.summary-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-grid {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary-card {
  min-width: 0;
  padding: 14px;
  background: var(--panel);
}

.summary-card .label,
.detail-card .label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.summary-card .value,
.detail-card .value {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

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

.panel-box-title {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.4;
}

.panel-box .summary-grid {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.panel-box .summary-card {
  padding: 0 12px;
  border-left: 1px solid var(--line);
  background: transparent;
}

.panel-box .summary-card:first-child {
  padding-left: 0;
  border-left: 0;
}

.services-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.service-chip {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  color: var(--accent);
  font-size: 12px;
}

.detail-grid {
  gap: 0 18px;
}

.detail-card {
  display: grid;
  grid-template-columns: minmax(70px, 0.42fr) minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-card-wide {
  grid-column: span 2;
}

.detail-card .value {
  margin-top: 0;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

.footer-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .page-shell {
    padding: 0;
  }

  .app-card {
    min-height: 100vh;
    padding: 14px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    padding-bottom: 12px;
  }

  .brand-mark {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    font-size: 19px;
  }

  .topbar h1 {
    max-width: 54vw;
    font-size: 16px;
  }

  .topbar p {
    display: none;
  }

  .theme-toggle,
  .back-link {
    min-height: 32px;
    padding: 0 9px;
    font-size: 12px;
  }

  .hero {
    padding-top: 16px;
  }

  .intro-copy {
    margin-bottom: 12px;
  }

  .intro-copy h2 {
    font-size: 21px;
  }

  .intro-copy p {
    margin-top: 3px;
    font-size: 12px;
  }

  .query-panels {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .search-panel {
    padding: 14px;
  }

  .section-title {
    margin-bottom: 12px;
  }

  .section-title h2 {
    font-size: 16px;
  }

  .step-number {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .search-row input,
  .search-row button {
    height: 40px;
  }

  .search-row button {
    min-width: 86px;
    padding: 0 11px;
    font-size: 13px;
  }

  .quick-actions {
    margin-top: 8px;
  }

  .result-toolbar {
    position: sticky;
    z-index: 5;
    top: 0;
    margin: -14px -14px 0;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(12px);
  }

  .result-page-wrap {
    padding-top: 14px;
  }

  .result-header {
    align-items: center;
    margin-bottom: 10px;
  }

  .result-header h1 {
    font-size: 18px;
  }

  .result-header p {
    display: none;
  }

  .notice-banner {
    margin: 12px 0 0;
    padding: 11px;
  }

  .identity-card {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 11px;
    padding: 14px;
  }

  .avatar {
    width: 62px;
    height: 62px;
    border-width: 2px;
  }

  .identity-name {
    font-size: 19px;
  }

  .identity-account,
  .identity-facts {
    font-size: 11px;
  }

  .identity-sub {
    margin-top: 5px;
    font-size: 12px;
  }

  .identity-facts {
    margin-top: 5px;
  }

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

  .summary-card {
    padding: 11px;
  }

  .summary-card .value {
    font-size: 13px;
  }

  .panel-box {
    padding: 13px;
  }

  .panel-box-title {
    margin-bottom: 9px;
    font-size: 14px;
  }

  .panel-box .summary-card {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    border-left: 0;
  }

  .panel-box .summary-card:nth-child(odd) {
    padding-left: 0;
    border-right: 1px solid var(--line);
  }

  .panel-box .summary-card:nth-child(even) {
    padding-right: 0;
  }

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

  .detail-card {
    display: block;
    padding: 9px 0;
  }

  .detail-card .value {
    margin-top: 3px;
    font-size: 12px;
    text-align: left;
  }

  .empty-state {
    min-height: 220px;
  }
}

@media (max-width: 370px) {
  .app-card {
    padding: 12px;
  }

  .result-toolbar {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .back-link span {
    display: none;
  }

  .topbar h1 {
    max-width: 50vw;
  }

  .search-row button {
    min-width: 80px;
  }

  .identity-facts {
    gap: 7px;
  }

  .identity-facts span + span {
    padding-left: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
