:root {
  --bg-start: #f6dff6;
  --bg-middle: #edf0ff;
  --bg-end: #dff3ff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.66);
  --line: rgba(137, 161, 212, 0.18);
  --line-strong: rgba(112, 138, 196, 0.24);
  --text-main: #17233b;
  --text-soft: #66738f;
  --text-muted: #8f9ab2;
  --accent: #5f7cf8;
  --accent-strong: #4767ee;
  --accent-soft: rgba(95, 124, 248, 0.12);
  --shadow-xl: 0 28px 80px rgba(83, 103, 161, 0.18);
  --shadow-lg: 0 18px 42px rgba(96, 119, 176, 0.14);
  --shadow-md: 0 12px 24px rgba(111, 133, 186, 0.1);
  --shadow-sm: 0 8px 16px rgba(137, 154, 199, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "SF Pro Text", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-middle) 50%, var(--bg-end) 100%);
}

body.is-modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.admin-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 24px;
}

.admin-shell__gradient,
.admin-shell__glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.admin-shell__gradient {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0) 36%),
    linear-gradient(135deg, var(--bg-start) 0%, var(--bg-middle) 52%, var(--bg-end) 100%);
  z-index: -3;
}

.admin-shell__glow {
  filter: blur(18px);
  z-index: -2;
}

.admin-shell__glow--one {
  inset: auto auto 12% 6%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 206, 236, 0.45);
}

.admin-shell__glow--two {
  inset: 8% 6% auto auto;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: rgba(178, 225, 255, 0.46);
}

.sidebar-panel,
.workspace,
.panel,
.stat-card,
.login-panel,
.detail-modal__dialog {
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.sidebar-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: calc(100vh - 48px);
  padding: 22px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-panel__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.sidebar-panel__brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #738bff, #7dd3fc);
  box-shadow: 0 14px 28px rgba(111, 131, 226, 0.28);
}

.sidebar-panel__brand-text {
  display: grid;
  gap: 4px;
}

.sidebar-panel__brand-text strong {
  font-size: 18px;
}

.sidebar-panel__brand-text small,
.sidebar-panel__profile small,
.sidebar-nav__link small,
.workspace-topbar__eyebrow,
.subtle-text,
.table-meta {
  color: var(--text-muted);
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav__link {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-main);
  border: 1px solid transparent;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.sidebar-nav__link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.46);
  border-color: rgba(137, 161, 212, 0.14);
}

.sidebar-nav__link.is-active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 248, 255, 0.74));
  border-color: rgba(112, 138, 196, 0.22);
  box-shadow: var(--shadow-md);
}

.sidebar-nav__emoji {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(95, 124, 248, 0.1);
  color: var(--accent-strong);
  font-weight: 700;
}

.sidebar-nav__link strong {
  display: block;
  margin-bottom: 4px;
}

.sidebar-panel__footer {
  margin-top: auto;
  display: grid;
  gap: 16px;
}

.sidebar-panel__profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.sidebar-panel__avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(96, 123, 245, 0.16), rgba(125, 211, 252, 0.3));
  color: var(--accent-strong);
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: 28px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-xl);
}

.workspace-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.workspace-topbar__title {
  margin: 6px 0 8px;
  font-size: 34px;
  line-height: 1.05;
}

.workspace-topbar__subtitle {
  margin: 0;
  max-width: 720px;
  font-size: 15px;
  color: var(--text-soft);
}

.workspace-content {
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-xl);
  padding: 24px;
}

.panel--soft {
  background: var(--surface-soft);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-head h2,
.section-head h3,
.panel h2,
.panel h3 {
  margin: 0;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 255, 0.74));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
}

.stat-card__label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.stat-card__value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-card__meta {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  color: var(--text-main);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.textarea {
  min-height: 120px;
  padding: 14px 16px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(95, 124, 248, 0.42);
  box-shadow: 0 0 0 4px rgba(95, 124, 248, 0.12);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.toolbar,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.toolbar--between {
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
  font-weight: 700;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: linear-gradient(135deg, #6f87ff, #76c8ff);
  color: #fff;
  box-shadow: 0 16px 28px rgba(92, 121, 238, 0.22);
}

.btn--primary:hover {
  box-shadow: 0 20px 32px rgba(92, 121, 238, 0.28);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--line);
  color: var(--text-main);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.42);
  border-color: rgba(255, 255, 255, 0.74);
  color: var(--text-main);
}

.btn--danger {
  background: rgba(255, 108, 108, 0.12);
  border-color: rgba(239, 68, 68, 0.16);
  color: #d1384f;
}

.btn--full {
  width: 100%;
}

.btn--sm {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 13px;
}

.alert {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}

.alert--success {
  background: rgba(22, 163, 74, 0.09);
  border-color: rgba(22, 163, 74, 0.18);
  color: #0f7b3b;
}

.alert--error {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.16);
  color: #c0374b;
}

.alert--info {
  background: rgba(95, 124, 248, 0.09);
  border-color: rgba(95, 124, 248, 0.16);
  color: #3d57c8;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge--unused {
  background: rgba(123, 146, 186, 0.12);
  color: #5f6f93;
}

.badge--used {
  background: rgba(34, 197, 94, 0.12);
  color: #128a4f;
}

.badge--revoked {
  background: rgba(239, 68, 68, 0.12);
  color: #c43c4f;
}

.badge--neutral {
  background: rgba(123, 146, 186, 0.1);
  color: var(--text-soft);
}

.topbar-pill,
.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.84);
  color: var(--text-soft);
  font-size: 13px;
}

.table-shell {
  overflow: hidden;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.table-scroll {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 16px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(137, 161, 212, 0.12);
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(250, 252, 255, 0.9);
  color: var(--text-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table tbody tr {
  transition: background 180ms ease, transform 180ms ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.5);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.table-stack {
  display: grid;
  gap: 6px;
}

.table-stack small {
  color: var(--text-muted);
}

.summary-text {
  display: inline-block;
  max-width: 320px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(243, 246, 255, 0.9);
  border: 1px solid rgba(137, 161, 212, 0.14);
  color: #1b2944;
  font-family: "SFMono-Regular", "SF Mono", Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.empty-state {
  padding: 54px 20px;
  text-align: center;
  color: var(--text-soft);
}

.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(137, 161, 212, 0.16);
  color: var(--text-main);
}

.pagination__item.is-active {
  background: linear-gradient(135deg, #6f87ff, #76c8ff);
  border-color: transparent;
  color: #fff;
}

.generated-list {
  display: grid;
  gap: 10px;
  max-height: 380px;
  overflow: auto;
  padding: 6px;
}

.generated-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(137, 161, 212, 0.14);
}

.generated-item__meta {
  color: var(--text-muted);
  font-size: 12px;
}

.detail-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 26px;
  z-index: 60;
}

.detail-modal.is-open {
  display: flex;
}

.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 31, 56, 0.28);
}

.detail-modal__dialog {
  position: relative;
  width: min(1040px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 30px 90px rgba(57, 73, 118, 0.24);
}

.detail-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: rgba(247, 249, 255, 0.94);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.detail-modal__content {
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px;
}

.detail-shell {
  display: grid;
  gap: 20px;
}

.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 255, 0.88));
  border: 1px solid rgba(137, 161, 212, 0.14);
}

.detail-hero__title {
  margin: 10px 0 12px;
  font-size: 28px;
}

.detail-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.detail-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(137, 161, 212, 0.14);
  box-shadow: var(--shadow-sm);
}

.detail-card__title {
  margin: 0 0 14px;
  font-size: 15px;
}

.detail-kv {
  display: grid;
  gap: 14px;
}

.detail-kv__item {
  display: grid;
  gap: 5px;
}

.detail-kv__label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-kv__value {
  color: var(--text-main);
  line-height: 1.55;
  word-break: break-word;
}

.detail-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-highlight {
  min-width: 140px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(95, 124, 248, 0.08);
  border: 1px solid rgba(95, 124, 248, 0.12);
}

.detail-highlight strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.structured {
  display: grid;
  gap: 12px;
}

.structured-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.structured-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(246, 248, 255, 0.82);
  border: 1px solid rgba(137, 161, 212, 0.12);
}

.structured-item__key {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.structured-item__value {
  line-height: 1.6;
  color: var(--text-main);
  word-break: break-word;
}

.structured-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.structured-pill {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(95, 124, 248, 0.08);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.structured-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(137, 161, 212, 0.14);
}

.code-block {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border-radius: 18px;
  background: #f4f7ff;
  border: 1px solid rgba(137, 161, 212, 0.16);
  color: #263451;
  font-size: 12px;
  line-height: 1.7;
  font-family: "SFMono-Regular", "SF Mono", Consolas, monospace;
}

.detail-timeline {
  display: grid;
  gap: 12px;
}

.detail-timeline__item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(246, 248, 255, 0.82);
  border: 1px solid rgba(137, 161, 212, 0.12);
}

.detail-timeline__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 12px;
  z-index: 80;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(24, 35, 59, 0.88);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.toast--error {
  background: rgba(171, 38, 63, 0.92);
}

.toast--success {
  background: rgba(21, 124, 75, 0.9);
}

.login-shell {
  position: relative;
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.login-shell__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
  pointer-events: none;
}

.login-shell__glow--one {
  width: 320px;
  height: 320px;
  background: rgba(255, 203, 231, 0.48);
  top: 10%;
  left: 8%;
}

.login-shell__glow--two {
  width: 360px;
  height: 360px;
  background: rgba(178, 225, 255, 0.48);
  right: 10%;
  bottom: 8%;
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 34px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-xl);
}

.login-brand {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.login-brand__mark {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #738bff, #7dd3fc);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 18px 34px rgba(95, 124, 248, 0.24);
}

.login-brand h1 {
  margin: 0;
  font-size: 32px;
}

.login-brand p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.login-meta {
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.loading-state {
  padding: 30px 20px;
  color: var(--text-soft);
}

.skeleton {
  background: linear-gradient(90deg, rgba(239, 243, 255, 0.85), rgba(255, 255, 255, 0.92), rgba(239, 243, 255, 0.85));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 16px;
}

.skeleton--line {
  height: 14px;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 1120px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-panel {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 768px) {
  .admin-shell,
  .workspace,
  .detail-modal__content,
  .login-panel {
    padding: 20px;
  }

  .workspace-topbar {
    flex-direction: column;
  }

  .workspace-topbar__title {
    font-size: 28px;
  }

  .panel,
  .stat-card,
  .detail-card,
  .detail-hero {
    padding: 18px;
  }

  .summary-text {
    max-width: 100%;
  }

  .detail-modal {
    padding: 14px;
  }

  .detail-modal__dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .detail-hero {
    flex-direction: column;
  }

  .toast-stack {
    right: 14px;
    left: 14px;
    bottom: 14px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}
