:root {
  --canvas: #f5f4f1;
  --surface: #ffffff;
  --surface-soft: #faf9f7;
  --ink: #211f2b;
  --muted: #746f7e;
  --muted-2: #9a95a2;
  --line: #e8e5eb;
  --line-strong: #dcd8e1;
  --brand: #6246ea;
  --brand-dark: #5035d5;
  --brand-soft: #eeeafd;
  --success: #2e7d55;
  --success-soft: #e8f5ed;
  --warning: #a15c14;
  --warning-soft: #fff1dc;
  --danger: #b44551;
  --danger-soft: #fdecef;
  --info: #316a9a;
  --info-soft: #e8f2fb;
  --shadow-sm: 0 1px 2px rgba(28, 23, 43, 0.04), 0 8px 24px rgba(28, 23, 43, 0.04);
  --shadow-lg: 0 24px 60px rgba(30, 21, 69, 0.15);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body { min-width: 320px; background: var(--canvas); }

button, input, select { font: inherit; }

button, a, input, select { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

a { color: inherit; }

[hidden] { display: none !important; }

.boot-screen,
.state-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
}

.boot-screen p,
.state-screen p { margin: 0; color: var(--muted); }

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 24px rgba(98, 70, 234, 0.25);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #ddd7f8;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(480px, 1.12fr);
  background: var(--surface);
}

.login-story {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 46px clamp(42px, 5vw, 78px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(circle at 16% 14%, rgba(160, 139, 255, 0.82), transparent 30%),
    radial-gradient(circle at 90% 78%, rgba(102, 201, 210, 0.48), transparent 34%),
    linear-gradient(145deg, #30206f 0%, #5134b8 50%, #2d245e 100%);
}

.login-story::before,
.login-story::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.login-story::before { width: 420px; height: 420px; right: -210px; top: 15%; }
.login-story::after { width: 240px; height: 240px; left: -120px; bottom: 12%; }

.login-brand,
.sidebar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand .brand-mark { background: rgba(255, 255, 255, 0.18); box-shadow: none; }

.login-brand strong,
.sidebar-brand strong { display: block; font-size: 19px; letter-spacing: -0.03em; }

.login-brand span,
.sidebar-brand span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.18em;
  opacity: 0.68;
}

.login-copy { position: relative; z-index: 1; max-width: 520px; margin: auto 0; padding: 50px 0; }
.login-copy h2 { margin: 0 0 20px; font-size: clamp(36px, 4vw, 58px); line-height: 1.08; letter-spacing: -0.055em; }
.login-copy p { max-width: 470px; margin: 0; font-size: 16px; line-height: 1.85; color: rgba(255, 255, 255, 0.72); }
.login-footnote { position: relative; z-index: 1; font-size: 12px; color: rgba(255, 255, 255, 0.52); }

.login-form-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px;
  background: linear-gradient(180deg, #fff, #faf9fc);
}

.login-card { width: min(100%, 440px); }
.login-eyebrow { margin: 0 0 12px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: 0.15em; }
.login-card h1 { margin: 0; font-size: 34px; letter-spacing: -0.045em; }
.login-intro { margin: 12px 0 32px; color: var(--muted); line-height: 1.7; }
.login-form { display: grid; gap: 20px; }
.field-label { display: grid; gap: 8px; color: #4e4958; font-size: 13px; font-weight: 700; }
.input-shell {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.input-shell:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(98, 70, 234, 0.1); }
.input-shell svg { flex: 0 0 auto; color: var(--muted-2); }
.input-shell input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.input-shell input::placeholder { color: #aaa5b0; }
.password-toggle { border: 0; background: transparent; padding: 5px; color: var(--muted); cursor: pointer; }
.form-error { margin: -5px 0 0; padding: 11px 13px; border-radius: 10px; color: var(--danger); background: var(--danger-soft); font-size: 13px; line-height: 1.5; }

.primary-button,
.secondary-button,
.retry-button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .12s, background .12s, opacity .12s;
}

.primary-button { min-height: 50px; color: #fff; background: var(--brand); box-shadow: 0 10px 22px rgba(98, 70, 234, 0.2); }
.primary-button:hover { background: var(--brand-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .65; cursor: wait; transform: none; }
.secondary-button,
.retry-button { border: 1px solid var(--line-strong); background: #fff; }
.secondary-button:hover,
.retry-button:hover { background: var(--surface-soft); }
.login-help { margin: 22px 0 0; color: var(--muted-2); font-size: 12px; text-align: center; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 248px;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.sidebar-brand { padding: 0 10px 24px; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.sidebar-brand span { color: var(--brand); opacity: 1; }
.sidebar-close { display: none; }
.nav-label { margin: 12px 12px 8px; color: var(--muted-2); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.admin-nav { display: grid; gap: 5px; }
.admin-nav a {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border-radius: 10px;
  color: #686371;
  text-decoration: none;
  font-size: 14px;
  font-weight: 680;
}

.admin-nav a:hover { color: var(--ink); background: var(--surface-soft); }
.admin-nav a.active { color: var(--brand); background: var(--brand-soft); }
.admin-nav svg { width: 20px; height: 20px; }
.sidebar-note { margin-top: auto; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.sidebar-note strong { display: block; font-size: 12px; }
.sidebar-note span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.55; }

.workspace { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 70px;
  padding: 0 clamp(24px, 4vw, 52px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  border-bottom: 1px solid rgba(225, 222, 228, .85);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
}

.mobile-menu { display: none; }
.admin-account { display: flex; align-items: center; gap: 13px; }
.admin-identity { display: grid; justify-items: end; gap: 2px; }
.admin-identity strong { font-size: 13px; }
.admin-identity span { color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.account-dot { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #dff2e6; color: #337251; font-size: 12px; font-weight: 800; }
.logout-button { border: 0; border-left: 1px solid var(--line); padding: 6px 0 6px 16px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.logout-button:hover { color: var(--danger); }

.admin-main { padding: 42px clamp(24px, 4vw, 52px) 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.page-heading h1 { margin: 0; font-size: clamp(27px, 3vw, 36px); letter-spacing: -0.045em; }
.page-heading p { margin: 9px 0 0; color: var(--muted); line-height: 1.65; }
.heading-meta { flex: 0 0 auto; color: var(--muted-2); font-size: 12px; }

.filter-card {
  margin-bottom: 18px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.search-field { min-width: 260px; flex: 1 1 330px; }
.search-field,
.select-field {
  height: 43px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-soft);
}

.search-field:focus-within,
.select-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(98, 70, 234, .08); }
.search-field input { min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; background: transparent; }
.select-field span { flex: 0 0 auto; color: var(--muted-2); font-size: 11px; font-weight: 700; }
.select-field select { height: 100%; border: 0; outline: 0; background: transparent; color: #4c4754; cursor: pointer; }

.table-card { min-height: 330px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 50px; padding: 0 17px; border-bottom: 1px solid var(--line); background: var(--surface-soft); color: var(--muted-2); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { min-height: 72px; padding: 15px 17px; border-bottom: 1px solid #efedf1; color: #46414d; font-size: 13px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fcfbfe; }
.primary-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e8e2ff; color: #6349c5; font-size: 12px; font-weight: 800; }
.avatar.alt { background: #e1f3e7; color: #36724f; }
.cell-stack { min-width: 0; display: grid; gap: 4px; }
.cell-stack strong { overflow: hidden; color: #312d36; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.cell-stack span,
.cell-muted { overflow: hidden; color: var(--muted-2); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 11px; }

.badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.neutral { color: #625d69; background: #f0eef2; }
.badge.brand { color: #5b40c7; background: var(--brand-soft); }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.info { color: var(--info); background: var(--info-soft); }

.message-details summary { max-width: 360px; overflow: hidden; list-style: none; cursor: pointer; color: #3e3946; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.message-details summary::-webkit-details-marker { display: none; }
.message-details summary::after { content: "展开"; margin-left: 8px; color: var(--brand); font-size: 10px; font-weight: 700; }
.message-details[open] summary { white-space: normal; }
.message-details[open] summary::after { content: "收起"; }
.message-details p { max-width: 520px; margin: 10px 0 0; color: #55505b; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }

.table-state { min-height: 328px; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 34px; color: var(--muted); text-align: center; }
.table-state h3 { margin: 0; color: #3d3844; font-size: 16px; }
.table-state p { max-width: 440px; margin: 0; font-size: 13px; line-height: 1.65; }
.state-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand); font-size: 20px; font-weight: 800; }
.skeleton-table { padding: 2px 0; }
.skeleton-row { height: 70px; display: grid; grid-template-columns: 1.5fr 1fr 1fr .8fr; align-items: center; gap: 28px; padding: 0 18px; border-bottom: 1px solid #efedf1; }
.skeleton-row span { height: 11px; border-radius: 999px; background: linear-gradient(90deg, #eeeaf1 20%, #f8f6f9 45%, #eeeaf1 70%); background-size: 250% 100%; animation: shimmer 1.25s linear infinite; }
@keyframes shimmer { to { background-position: -250% 0; } }

.pagination { min-height: 66px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.page-summary { color: var(--muted); font-size: 12px; }
.pager-controls { display: flex; align-items: center; gap: 7px; }
.pager-button { min-width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; cursor: pointer; }
.pager-button:hover:not(:disabled) { border-color: #bcb4dd; color: var(--brand); }
.pager-button:disabled { opacity: .4; cursor: default; }
.page-current { min-width: 72px; color: var(--muted); font-size: 12px; text-align: center; }
.limit-select { height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; background: #fff; color: var(--muted); font-size: 12px; }
.sidebar-scrim { display: none; }

@media (max-width: 1050px) {
  .admin-shell { grid-template-columns: 218px minmax(0, 1fr); }
  .sidebar { width: 218px; }
  .data-table { min-width: 930px; }
}

@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-story { min-height: 290px; padding: 30px; }
  .login-copy { margin: auto 0 0; padding: 40px 0 14px; }
  .login-copy h2 { font-size: 34px; }
  .login-copy p { display: none; }
  .login-footnote { display: none; }
  .login-form-panel { min-height: auto; padding: 48px 24px 70px; }
  .admin-shell { display: block; }
  .sidebar { width: min(285px, 88vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { position: absolute; top: 25px; right: 18px; z-index: 2; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--surface-soft); cursor: pointer; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; display: block; border: 0; background: rgba(27, 22, 37, .36); }
  .workspace { min-width: 0; }
  .topbar { height: 64px; padding: 0 20px; justify-content: space-between; }
  .mobile-menu { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
  .admin-identity span { display: none; }
  .logout-button { padding-left: 12px; }
  .admin-main { padding: 28px 18px 50px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .heading-meta { display: none; }
  .filter-card { align-items: stretch; }
  .search-field { flex-basis: 100%; min-width: 0; }
  .select-field { flex: 1 1 150px; justify-content: space-between; }
}

@media (max-width: 520px) {
  .login-story { min-height: 245px; }
  .login-copy h2 { font-size: 29px; }
  .login-form-panel { place-items: start center; }
  .login-card h1 { font-size: 29px; }
  .admin-account { gap: 8px; }
  .admin-identity { display: none; }
  .logout-button { border-left: 0; padding-left: 6px; }
  .filter-card { padding: 10px; }
  .select-field { flex-basis: 100%; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .pager-controls { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
