:root {
  color-scheme: light;
  --ink: #12264a;
  --muted: #6d7890;
  --line: rgba(34, 59, 92, 0.12);
  --cream: #fbfaf5;
  --surface: rgba(255, 255, 255, 0.82);
  --blue: #6fa8ff;
  --mint: #56cdb0;
  --lilac: #a589f7;
  --coral: #ff8f82;
  --shadow: 0 18px 60px rgba(39, 70, 104, 0.09);
  font-family: "Aptos", "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--cream);
  overflow: hidden;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.aurora {
  position: fixed;
  z-index: -1;
  width: 48vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.22;
  pointer-events: none;
}
.aurora-mint { top: -28vw; right: -12vw; background: #9eead9; }
.aurora-lilac { bottom: -32vw; left: -12vw; background: #cfc1ff; }

.topbar {
  height: 78px;
  padding: 14px clamp(20px, 3vw, 48px);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; width: max-content; font-size: 22px; font-weight: 800; }
.brand small { margin-left: 2px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }
.brand-mark { width: 27px; height: 27px; color: #315fa9; transform: rotate(-8deg); }
.brand-mark svg, .empty-symbol svg, .dialog-symbol svg { width: 100%; height: 100%; fill: currentColor; }

.product-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.64);
  box-shadow: 0 8px 26px rgba(45, 70, 92, 0.06);
}
.product-switcher a { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 9px; color: #45526b; font-size: 13px; transition: background 160ms ease, color 160ms ease; }
.product-switcher a:hover { color: var(--ink); background: rgba(255,255,255,0.9); }
.product-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: white; font-size: 11px; font-weight: 800; }
.blue { background: var(--blue); }
.mint { background: var(--mint); }
.lilac { background: var(--lilac); }

.top-actions { justify-self: end; display: flex; align-items: center; gap: 11px; }
.environment-badge { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.68); font-size: 11px; }
.avatar-button { width: 42px; height: 42px; border: 1px solid rgba(60,88,122,.18); border-radius: 50%; color: #23477d; background: linear-gradient(145deg, #e4f8f3, #eef0ff); font-weight: 800; cursor: pointer; }

.dashboard {
  height: calc(100vh - 94px);
  max-width: 1540px;
  margin: 0 auto 16px;
  padding: 0 clamp(18px, 2vw, 32px);
  display: grid;
  grid-template-columns: minmax(236px, 0.78fr) minmax(470px, 1.8fr) minmax(275px, 0.9fr);
  gap: 16px;
}

.panel {
  min-height: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.identity-panel { padding: clamp(20px, 2.3vw, 30px); display: flex; flex-direction: column; text-align: center; overflow: auto; }
.identity-orbit { position: relative; width: 98px; height: 98px; margin: 2px auto 15px; display: grid; place-items: center; border: 1px solid rgba(111,168,255,.35); border-radius: 50%; background: radial-gradient(circle at 42% 34%, #fff, #dff5ef 55%, #e6e4ff); box-shadow: 0 16px 34px rgba(89,128,171,.12); }
.identity-orbit::after { content: ""; position: absolute; inset: -8px 8px 7px -9px; border: 1px dashed rgba(165,137,247,.4); border-radius: 50%; transform: rotate(24deg); }
.avatar-large { font-size: 28px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(20px, 2vw, 26px); }
h2 { margin-bottom: 0; font-size: clamp(20px, 2vw, 25px); }
h3 { margin-bottom: 0; font-size: 15px; }
.muted { min-height: 38px; margin-bottom: 19px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }

.level-card { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(247,248,255,.72); text-align: left; }
.level-card > div:first-child { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.level-card strong { color: #765ec5; }
.progress { height: 6px; margin-top: 11px; overflow: hidden; border-radius: 3px; background: #e9e7ef; }
.progress span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--blue), var(--lilac)); transform: scaleX(var(--progress, .08)); transform-origin: left center; transition: transform 400ms cubic-bezier(.22,1,.36,1); }

.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 20px 0; }
.quick-stats div + div { border-left: 1px solid var(--line); }
.quick-stats dt { color: var(--muted); font-size: 11px; }
.quick-stats dd { margin: 5px 0 0; font-size: 19px; font-weight: 800; }

.side-menu { display: grid; gap: 5px; margin-bottom: 16px; text-align: left; }
.side-menu button { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; padding: 9px 10px; border: 0; border-radius: 9px; color: #4b5970; background: transparent; text-align: left; }
.menu-icon { width: 15px; height: 15px; }
.menu-icon svg, .security-icon svg, .shield svg, .privacy-note svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-menu button.active { color: #264a7a; background: #edf5ff; }
.side-menu button:disabled { opacity: .7; }
.side-menu small { font-size: 9px; }

.primary-action { width: 100%; margin-top: auto; padding: 11px 16px; border: 1px solid #456fa5; border-radius: 11px; color: white; background: #315f96; box-shadow: 0 9px 20px rgba(49,95,150,.18); cursor: pointer; font-weight: 700; }
.primary-action:hover { background: #284f7e; }
.primary-action:focus-visible, .secondary-action:focus-visible, .dialog-close:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 34%, transparent); outline-offset: 3px; }

.activity-panel { padding: clamp(20px, 2.3vw, 32px); overflow: hidden; display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel-heading.compact { align-items: flex-start; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; color: #397962; font-size: 11px; }
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(86,205,176,.12); }

.product-path { min-height: 194px; display: grid; grid-template-columns: 1fr minmax(18px, .42fr) 1fr minmax(18px, .42fr) 1fr; align-items: center; padding: 18px 6px 11px; }
.path-node { min-width: 0; display: grid; justify-items: center; gap: 6px; text-align: center; }
.path-node strong { font-size: 13px; }
.path-node small { color: var(--muted); font-size: 10px; }
.node-icon { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 22px; color: white; font-size: 20px; font-weight: 900; border: 6px solid rgba(255,255,255,.72); box-shadow: 0 16px 28px rgba(58,93,132,.13); transition: transform 170ms ease; }
.path-node:hover .node-icon { transform: translateY(-3px); }
.blue-node .node-icon { background: linear-gradient(145deg, #8bc2ff, #527fe6); }
.mint-node .node-icon { background: linear-gradient(145deg, #7de1c6, #38ae8e); }
.lilac-node .node-icon { background: linear-gradient(145deg, #c2abff, #8063dc); }
.path-line { height: 2px; margin-top: -24px; background: linear-gradient(90deg, rgba(111,168,255,.25), rgba(86,205,176,.7), rgba(165,137,247,.3)); }

.activity-section { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-title span { color: var(--muted); font-size: 10px; }
.empty-activity { flex: 1; min-height: 150px; display: flex; align-items: center; justify-content: center; gap: 17px; color: var(--muted); }
.empty-activity strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 14px; }
.empty-activity p { max-width: 380px; margin: 0; font-size: 11px; line-height: 1.6; }
.empty-symbol { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #7562bc; background: #f0edff; }
.empty-symbol svg { width: 21px; height: 21px; }
.security-panel { padding: clamp(20px, 2.2vw, 29px); overflow: auto; }
.shield { display: grid; place-items: center; width: 42px; height: 46px; border-radius: 16px 16px 22px 22px; color: white; background: linear-gradient(145deg, #8ae1ca, #40b191); box-shadow: 0 12px 25px rgba(64,177,145,.2); font-size: 19px; font-weight: 900; }
.shield svg { width: 23px; height: 23px; stroke-width: 2.4; }
.security-score { margin: 28px 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); text-align: center; }
.security-score strong { display: block; margin-bottom: 4px; font-size: 22px; }
.security-score span { color: var(--muted); font-size: 11px; }
.security-list { margin: 0; padding: 0; list-style: none; }
.security-list li { display: grid; grid-template-columns: 31px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.security-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: #4c5f79; background: #f2f4f7; font-size: 12px; font-weight: 800; }
.security-list strong, .security-list small { display: block; }
.security-list strong { font-size: 12px; }
.security-list small { margin-top: 3px; color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; }
.security-list b { color: #8a94a4; font-size: 10px; white-space: nowrap; }
.security-list b.good { color: #309270; }
.privacy-note { display: flex; gap: 10px; margin-top: 20px; padding: 13px; border: 1px solid #d8e7f7; border-radius: 12px; color: #496887; background: #f2f8ff; }
.privacy-note > span { flex: 0 0 16px; width: 16px; height: 16px; }
.privacy-note p { margin: 0; font-size: 10px; line-height: 1.6; }
.privacy-note strong { color: #244d78; }

.auth-dialog { width: min(430px, calc(100vw - 28px)); padding: 32px; border: 1px solid rgba(46,71,104,.15); border-radius: 21px; color: var(--ink); background: #fffefa; box-shadow: 0 28px 90px rgba(32,58,93,.22); }
.auth-dialog::backdrop { background: rgba(20,34,54,.33); backdrop-filter: blur(7px); }
.dialog-close { position: absolute; top: 13px; right: 15px; width: 32px; height: 32px; border: 0; border-radius: 50%; color: #657086; background: #f2f3f5; cursor: pointer; font-size: 20px; }
.dialog-symbol { width: 48px; height: 48px; margin-bottom: 18px; display: grid; place-items: center; border-radius: 15px; color: #315f96; background: linear-gradient(145deg, #dff6ef, #e7e6ff); font-size: 22px; }
.auth-dialog h2 { margin-bottom: 9px; }
.dialog-copy { color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-actions { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 10px; margin-top: 22px; }
.auth-actions .primary-action { margin: 0; }
.secondary-action { min-height: 43px; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--ink) 24%, transparent); border-radius: 11px; color: var(--ink); background: color-mix(in srgb, var(--blue) 9%, white); cursor: pointer; font-weight: 700; }
.secondary-action:hover { border-color: color-mix(in srgb, var(--ink) 38%, transparent); background: color-mix(in srgb, var(--blue) 16%, white); }
.provider-note { display: flex; align-items: center; gap: 7px; margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.provider-note span { display: grid; flex: 0 0 19px; width: 19px; height: 19px; place-items: center; border-radius: 50%; color: var(--ink); background: color-mix(in srgb, var(--mint) 18%, white); font-weight: 800; }
.form-error { min-height: 15px; margin: 8px 0 0; color: #b84747; font-size: 11px; }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: 1fr auto; }
  .product-switcher { display: none; }
  .dashboard { grid-template-columns: minmax(205px,.72fr) minmax(390px,1.5fr) minmax(225px,.82fr); gap: 12px; padding-inline: 12px; }
  .identity-panel, .activity-panel, .security-panel { padding: 20px; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { position: sticky; top: 0; z-index: 5; height: 66px; padding: 10px 15px; background: rgba(251,250,245,.88); backdrop-filter: blur(14px); }
  .dashboard { height: auto; min-height: calc(100vh - 66px); grid-template-columns: 1fr; padding: 8px 12px 18px; }
  .identity-panel { min-height: 530px; }
  .activity-panel { min-height: 610px; }
  .security-panel { display: block; min-height: 540px; }
}

@media (max-width: 760px) {
  .brand { font-size: 18px; }
  .brand small { display: none; }
  .product-path { grid-template-columns: repeat(3,1fr); min-height: 170px; }
  .path-line { display: none; }
  .node-icon { width: 58px; height: 58px; }
  .section-title span { display: none; }
  .auth-actions { grid-template-columns: 1fr; }
}

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