:root {
  --primary: #4a38d4;
  --primary-dark: #2e1f9e;
  --primary-soft: #e8e5fb;
  --primary-tint: #f4f2fe;
  --gold: #c7894a;
  --green: #1f9d55;
  --red: #d04545;
  --ink: #1a1a2e;
  --ink-soft: #3a3a4e;
  --muted: #6b6b7e;
  --faint: #9a95a8;
  --bg: #efebf7;
  --surface: #ffffff;
  --surface-soft: #fbfaff;
  --line: rgba(74, 56, 212, 0.14);
  --shadow: 0 16px 34px -24px rgba(74, 56, 212, 0.45), 0 6px 14px rgba(26, 26, 46, 0.06);
  --font-display: "Fraunces", "Microsoft YaHei", "微软雅黑", Georgia, serif;
  --font-ui: "Manrope", "Microsoft YaHei", "微软雅黑", -apple-system, "PingFang SC", system-ui, sans-serif;
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(at 18% 8%, rgba(232, 229, 251, 0.85) 0%, transparent 55%),
    radial-gradient(at 82% 92%, rgba(255, 240, 220, 0.55) 0%, transparent 50%),
    linear-gradient(180deg, #f7f5ff 0%, var(--bg) 42%, #ffffff 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 8px 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

button,
.ghost-button,
.primary-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(74, 56, 212, 0.26);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ghost-button,
.segmented-filter button,
.tabs button,
.role-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-soft);
  padding: 0 13px;
  font-weight: 800;
}

.ghost-button:hover,
.segmented-filter button:hover,
.segmented-filter button.active,
.tabs button:hover,
.tabs button.active,
.role-switch button:hover,
.role-switch button.active {
  border-color: rgba(74, 56, 212, 0.32);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  padding: 0 15px;
  font-weight: 850;
}

.primary-button:hover {
  background: var(--primary-dark);
}

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

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 650;
}

.login-brand span,
.login-note,
.login-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--primary-tint);
}

.login-tabs button {
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 850;
}

.login-tabs button.active {
  background: var(--surface);
  color: var(--primary-dark);
}

.login-method {
  display: grid;
  gap: 12px;
}

.login-submit {
  width: 100%;
}

.console-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.console-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.console-brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 8px 22px -14px rgba(74, 56, 212, 0.72);
}

.console-brand strong,
.console-brand small {
  display: block;
}

.console-brand strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
}

.console-brand em {
  color: var(--primary);
  font-style: italic;
}

.console-brand small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 22px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--primary-tint);
}

.role-switch button {
  min-height: 32px;
  border-radius: 999px;
  font-size: 13px;
}

.rail-nav {
  display: grid;
  gap: 5px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.rail-nav a:hover,
.rail-nav a.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--primary);
  font-size: 13px;
}

.console-main {
  min-width: 0;
  padding: 24px;
}

.console-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.console-top h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 650;
  line-height: 1.12;
}

.top-actions,
.segmented-filter,
.tabs,
.diff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.overview-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: stretch;
  min-height: 158px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f6ff 68%, #fff8ed 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.overview-copy,
.overview-meta {
  padding: 24px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 14px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(199, 137, 74, 0.13);
  color: #8a551e;
  font-size: 12px;
  font-weight: 850;
}

.overview-copy h2 {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 650;
}

.overview-copy p,
.overview-meta small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.overview-meta {
  display: grid;
  align-content: center;
  background: rgba(74, 56, 212, 0.07);
}

.overview-meta span,
.overview-meta small,
.overview-meta strong {
  display: block;
}

.overview-meta span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 850;
}

.overview-meta strong {
  margin: 8px 0;
  font-size: 18px;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.78fr);
  gap: 12px;
  margin-bottom: 16px;
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  font-size: 18px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.wecom-card {
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
}

.wecom-login-frame {
  width: 100%;
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wecom-login-frame iframe {
  width: 100%;
  min-height: 300px;
  border: 0;
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 116px;
  padding: 16px;
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 850;
}

.metric-card strong {
  margin: 12px 0 8px;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
}

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

.trend.up {
  color: var(--green);
}

.trend.warn {
  color: #9a661f;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(460px, 1.5fr) minmax(300px, 0.9fr);
  gap: 16px;
}

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

.panel.wide,
.detail-panel {
  grid-column: 1 / -1;
}

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 11px;
  border-bottom: 1px solid rgba(74, 56, 212, 0.1);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--primary-tint);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

td strong,
td span,
.score {
  display: block;
}

td span {
  margin-top: 3px;
  color: var(--faint);
  font-size: 12px;
}

.score {
  font-weight: 850;
}

.score.good {
  color: var(--green);
}

.score.warn {
  color: #9a661f;
}

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

.tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin: 0;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 850;
}

.tag.success {
  background: rgba(31, 157, 85, 0.1);
  color: var(--green);
}

.tag.danger {
  background: rgba(208, 69, 69, 0.1);
  color: var(--red);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(22px, 1fr));
  align-items: end;
  height: 182px;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.bar-chart span {
  min-height: 18px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--primary) 0%, #806ff0 100%);
}

.insight-list,
.rule-list,
.class-stack {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.insight-list li,
.rule-list article,
.class-stack article,
.release-card {
  border: 1px solid rgba(74, 56, 212, 0.11);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.insight-list strong,
.insight-list span,
.rule-list strong,
.rule-list span,
.class-stack span,
.class-stack strong {
  display: block;
}

.insight-list strong,
.rule-list strong,
.class-stack strong {
  font-size: 13px;
}

.insight-list span,
.rule-list span,
.class-stack span,
.release-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.progress {
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--gold));
}

.release-card span,
.release-card strong {
  display: block;
}

.release-card span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 850;
}

.release-card strong {
  margin-top: 6px;
  font-size: 20px;
}

.diff-row {
  margin-top: 12px;
}

.diff-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(199, 137, 74, 0.12);
  color: #8a551e;
  font-size: 12px;
  font-weight: 850;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  color: #fff;
  font-weight: 850;
}

.profile-head strong,
.profile-head span {
  display: block;
}

.profile-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

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

.detail-grid div {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--primary-tint);
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.detail-grid strong {
  margin-top: 10px;
  font-size: 18px;
}

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

.form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-box {
  min-height: 130px;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #17172a;
  color: #f0efff;
  font-size: 12px;
  white-space: pre-wrap;
}

.empty-state {
  display: block;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.permission-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.permission-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.permission-item strong,
.permission-item span {
  display: block;
}

.permission-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.permission-item label {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
}

.permission-item input {
  width: auto;
  min-height: auto;
}

[hidden],
.is-hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .console-shell,
  .overview-band,
  .auth-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .console-rail {
    position: static;
    height: auto;
  }

  .rail-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .console-main,
  .console-rail {
    padding: 16px;
  }

  .console-top,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .rail-nav,
  .metric-grid,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .overview-copy,
  .overview-meta {
    padding: 18px;
  }

  .segmented-filter,
  .tabs,
  .top-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .code-row,
  .wecom-card {
    grid-template-columns: 1fr;
  }
}
