:root {
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  color: #172033;
  background: #f3f5f8;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --surface-strong: #edf0f4;
  --ink: #172033;
  --muted: #687386;
  --faint: #98a2b3;
  --line: #dce2e9;
  --line-strong: #c8d0da;
  --sidebar: #151922;
  --sidebar-soft: #1e2430;
  --sidebar-line: #2b3240;
  --brand: #3157d5;
  --brand-hover: #2445b8;
  --brand-soft: #eef2ff;
  --success: #087a55;
  --success-soft: #e8f6f0;
  --warning: #9a5c00;
  --warning-soft: #fff4d9;
  --danger: #c4323f;
  --danger-soft: #fff0f1;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body, button, input, select, textarea { letter-spacing: .01em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
strong { font-weight: 650; }
::selection { color: #fff; background: var(--brand); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #f7f9fc;
  background: var(--sidebar);
  border-right: 1px solid #11141b;
}
.brand {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 22px;
  color: #fff;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand:hover { color: #fff; text-decoration: none; background: #181d27; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; display: block; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
.brand > span, .login-brand > span { min-width: 0; display: grid; gap: 3px; }
.brand strong, .login-brand strong { font-size: 15px; letter-spacing: -.01em; }
.brand small, .login-brand small { color: #9ea8b8; font: 500 10px/1.2 "Cascadia Mono", Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; }

.nav-label {
  padding: 24px 22px 9px;
  color: #737f91;
  font: 600 10px/1 "Cascadia Mono", Consolas, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.nav-list { display: grid; gap: 4px; padding: 0 12px; }
.nav-list a {
  position: relative;
  min-height: 46px;
  display: grid;
  grid-template-columns: 31px 1fr;
  align-items: center;
  padding: 0 12px;
  color: #b8c1cf;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.nav-list a:hover { color: #fff; background: #1b212c; text-decoration: none; }
.nav-list a.active { color: #fff; background: var(--sidebar-soft); border-color: #30394a; }
.nav-list a.active::before { content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 2px; background: #6e8cff; }
.nav-index { color: #657185; font: 500 10px/1 "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; }
.nav-list a.active .nav-index { color: #91a7ff; }

.sidebar-footer {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--sidebar-line);
}
.account-link {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px;
  color: #edf1f7;
  border-radius: 6px;
}
.account-link:hover, .account-link.active { color: #fff; background: var(--sidebar-soft); text-decoration: none; }
.account-avatar { width: 36px; height: 36px; display: grid; place-items: center; color: #dce4ff; background: #29334c; border: 1px solid #3a4764; border-radius: 6px; font-weight: 700; }
.account-copy { min-width: 0; display: grid; gap: 2px; }
.account-copy strong { overflow: hidden; color: inherit; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { color: #7f8a9b; font: 500 10px/1.2 "Cascadia Mono", Consolas, monospace; text-transform: uppercase; }
.link-button {
  width: 36px;
  height: 36px;
  padding: 0;
  color: #8995a7;
  background: transparent;
  border: 1px solid #343c49;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
}
.link-button:hover { color: #fff; background: #252c38; border-color: #485266; }
.nav-scrim { display: none; }

.main-content { min-width: 0; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 30px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}
.page-heading { min-width: 0; display: grid; gap: 5px; }
.page-heading > span { color: var(--faint); font: 600 10px/1 "Cascadia Mono", Consolas, monospace; letter-spacing: .1em; }
.page-heading h1 { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #111827; font-size: 23px; line-height: 1.15; letter-spacing: -.025em; }
.topbar-actions { min-width: 0; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mobile-nav {
  display: none;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 19px;
}
.content-band { width: 100%; padding: 30px 30px 56px; }
.content-inner { width: 100%; max-width: 1480px; margin: 0 auto; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 6px;
  white-space: nowrap;
  font-weight: 650;
  line-height: 1.2;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
}
.button:hover { text-decoration: none; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 1px 2px rgba(49,87,213,.18); }
.button-primary:hover { color: #fff; background: var(--brand-hover); border-color: var(--brand-hover); }
.button-quiet { color: #344054; background: var(--surface); border-color: var(--line-strong); }
.button-quiet:hover { color: #172033; background: var(--surface-soft); border-color: #aeb8c5; }
.button-danger { color: var(--danger); background: var(--surface); border-color: #efbdc2; }
.button-danger:hover { color: #a92531; background: var(--danger-soft); border-color: #df8f98; }
.button-block { width: 100%; }

.notice {
  margin: 20px 30px 0;
  padding: 13px 15px;
  color: #344054;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 6px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.content-inner > .notice { margin: 0 0 20px; }
.notice-success { color: #086044; background: #f0faf6; border-color: #9dd8c2; border-left-color: var(--success); }
.notice-error { color: #922431; background: #fff5f6; border-color: #efbcc2; border-left-color: var(--danger); }
.notice-warning { color: #754700; background: #fff9eb; border-color: #ecd296; border-left-color: #c17a00; }
.inline-notice { margin: 0 20px 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 14px; }
.stat {
  position: relative;
  min-height: 138px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  gap: 4px 12px;
  padding: 18px 20px;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.stat:hover { color: var(--ink); border-color: #aebbe8; text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 28px rgba(35,52,94,.08); }
.stat::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--brand); opacity: 0; transition: opacity .15s ease; }
.stat:hover::after { opacity: 1; }
.stat-index { color: var(--faint); font: 500 10px/1 "Cascadia Mono", Consolas, monospace; letter-spacing: .08em; }
.stat-label { grid-column: 1; align-self: end; color: var(--muted); font-size: 13px; }
.stat strong { grid-column: 1; align-self: center; color: #101828; font-size: 34px; font-weight: 600; line-height: 1; letter-spacing: -.04em; }
.stat-link { grid-column: 2; grid-row: 1 / 4; align-self: end; color: var(--brand); font-size: 12px; font-weight: 650; }
.stat-link::after { content: " →"; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr); gap: 18px; margin-top: 18px; }
.section-block, .form-section {
  margin-top: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.dashboard-grid .section-block { min-width: 0; margin-top: 0; }
.dashboard-primary table { min-width: 600px; }
.section-first { margin-top: 0; }
.section-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.section-heading h2, .form-section h2 { margin: 0; color: #172033; font-size: 15px; letter-spacing: -.01em; }
.section-heading > a { font-size: 12px; font-weight: 650; }
.form-section h2 { padding: 18px 20px; background: #fbfcfd; border-bottom: 1px solid var(--line); }

.table-wrap { width: 100%; overflow-x: auto; scrollbar-color: #c6ced8 transparent; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid #e8ebef; text-align: left; vertical-align: middle; }
th {
  color: #667085;
  background: #f8f9fb;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbff; }
td { color: #344054; }
td strong { color: #172033; }
.actions-cell { display: flex; justify-content: flex-end; gap: 6px; }
.actions-cell form { margin: 0; }
.actions-cell .button, td > .button { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.empty { margin: 0; padding: 34px 20px; color: var(--muted); text-align: center; }
.table-note { margin: 0; padding: 11px 16px; color: var(--muted); background: #fbfcfd; border-top: 1px solid var(--line); font-size: 12px; }
.details-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.status::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; background: currentColor; border-radius: 50%; }
.status-active { color: var(--success); background: var(--success-soft); }
.status-disabled, .status-suspended { color: var(--warning); background: var(--warning-soft); }
.status-revoked { color: var(--danger); background: var(--danger-soft); }
.mono { font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; font-size: .94em; }
.muted { color: var(--muted); }

.filter-bar { display: grid; grid-template-columns: minmax(240px, 440px) auto; gap: 9px; align-items: center; margin-bottom: 2px; }
.filter-wide { grid-template-columns: minmax(240px, 1fr) minmax(170px, 260px) 170px auto; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
input::placeholder, textarea::placeholder { color: #98a2b3; }
textarea { resize: vertical; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: #aab4c1; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(49,87,213,.12); }
input:disabled, select:disabled, textarea:disabled { color: #697586; background: #f0f2f5; border-color: #e0e4ea; opacity: 1; }
label { min-width: 0; display: grid; align-content: start; gap: 7px; color: #344054; font-size: 13px; font-weight: 650; }
label small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; }

.editor-form { width: min(100%, 1040px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 20px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.key-output { width: calc(100% - 40px); height: 320px; margin: 18px 20px; padding: 14px; white-space: pre; background: #111722; color: #dce5ff; border-color: #111722; }
.key-output:focus { border-color: #6e8cff; box-shadow: 0 0 0 3px rgba(110,140,255,.2); }
.result-meta { display: flex; flex-wrap: wrap; gap: 16px 32px; padding: 16px 20px 0; color: var(--muted); }
.result-meta strong { color: var(--ink); }
.summary-row { display: flex; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--line); }

.detail-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.detail-strip > div { min-width: 0; min-height: 92px; display: grid; align-content: center; gap: 7px; padding: 15px 18px; border-right: 1px solid var(--line); }
.detail-strip > div:last-child { border-right: 0; }
.detail-strip span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.detail-strip strong { min-width: 0; overflow: hidden; color: var(--ink); text-overflow: ellipsis; }

.event-list { display: grid; }
.event-list > div {
  min-height: 64px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #e8ebef;
}
.event-list > div:last-child { border-bottom: 0; }
.event-list > div:hover { background: #fafbff; }
.event-list i { width: 7px; height: 7px; background: #6e8cff; border-radius: 50%; box-shadow: 0 0 0 4px #eef2ff; }
.event-copy { min-width: 0; display: grid; gap: 4px; }
.event-copy strong { overflow: hidden; color: #263247; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.event-copy small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.event-list time { color: var(--faint); font: 500 10px/1 "Cascadia Mono", Consolas, monospace; white-space: nowrap; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #edf0f5;
}
.login-shell {
  width: min(100%, 850px);
  min-height: 520px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid #d6dce5;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(20,29,47,.16);
}
.login-identity { position: relative; display: flex; flex-direction: column; padding: 34px; color: #fff; background: var(--sidebar); }
.login-brand { display: flex; align-items: center; gap: 13px; color: #fff; }
.login-brand .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
.login-code { display: grid; gap: 13px; margin: auto 0; }
.login-code span, .login-heading > span { color: #7f8b9e; font: 600 10px/1 "Cascadia Mono", Consolas, monospace; letter-spacing: .12em; }
.login-code strong { max-width: 210px; color: #f7f9fc; font-size: 27px; line-height: 1.25; letter-spacing: -.035em; }
.login-signal { display: flex; align-items: center; gap: 9px; color: #8f9aad; font: 600 10px/1 "Cascadia Mono", Consolas, monospace; letter-spacing: .1em; }
.login-signal i { width: 7px; height: 7px; background: #43c792; border-radius: 50%; box-shadow: 0 0 0 4px rgba(67,199,146,.1); }
.login-panel { align-self: center; width: 100%; padding: 48px 56px; }
.login-heading { display: grid; gap: 12px; margin-bottom: 28px; }
.login-heading h1 { margin: 0; color: #101828; font-size: 28px; font-weight: 650; line-height: 1.15; letter-spacing: -.035em; }
.login-panel .notice { margin: 0 0 18px; }
.form-stack { display: grid; gap: 19px; }
.form-stack .button { margin-top: 4px; min-height: 44px; }

.account-summary {
  max-width: 780px;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.account-summary > div { min-height: 86px; display: grid; align-content: center; gap: 7px; padding: 14px 18px; border-right: 1px solid var(--line); }
.account-summary > div:last-child { border-right: 0; }
.account-summary span { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.account-summary strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; }

@media (max-width: 1180px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-secondary .event-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-secondary .event-list > div:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .dashboard-secondary .event-list > div { border-right: 1px solid #e8ebef; }
  .dashboard-secondary .event-list > div:nth-child(even) { border-right: 0; }
}

@media (max-width: 940px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; width: 252px; transform: translateX(-100%); transition: transform .18s ease; }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 18px 0 50px rgba(10,14,23,.24); }
  .nav-scrim { position: fixed; z-index: 25; inset: 0; display: block; visibility: hidden; padding: 0; background: rgba(15,20,31,.42); border: 0; opacity: 0; transition: opacity .18s ease, visibility .18s ease; }
  body.nav-open .nav-scrim { visibility: visible; opacity: 1; }
  .mobile-nav { display: inline-grid; place-items: center; }
  .stats-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .detail-strip { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .detail-strip > div:nth-child(2) { border-right: 0; }
  .detail-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .filter-wide { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .topbar { min-height: 72px; padding: 0 14px; }
  .page-heading { gap: 3px; }
  .page-heading > span { display: none; }
  .page-heading h1 { font-size: 20px; }
  .content-band { padding: 18px 12px 40px; }
  .notice { margin: 12px 12px 0; }
  .content-inner > .notice { margin: 0 0 16px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .button { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .stats-grid, .form-grid, .detail-strip { grid-template-columns: 1fr; }
  .stat { min-height: 120px; }
  .span-2 { grid-column: span 1; }
  .detail-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .detail-strip > div:last-child { border-bottom: 0; }
  .filter-bar, .filter-wide { grid-template-columns: 1fr; }
  .section-block, .form-section { margin-top: 16px; border-radius: 7px; }
  .section-first { margin-top: 0; }
  .form-grid { gap: 17px; padding: 17px; }
  .dashboard-secondary .event-list { grid-template-columns: 1fr; }
  .dashboard-secondary .event-list > div { border-right: 0; border-bottom: 1px solid #e8ebef; }
  .event-list > div { min-height: 61px; padding: 10px 14px; }
  .key-output { width: calc(100% - 32px); height: 260px; margin: 16px; }
  .account-summary { grid-template-columns: 1fr; }
  .account-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .account-summary > div:last-child { border-bottom: 0; }
  .login-page { padding: 14px; }
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-identity { min-height: 170px; padding: 24px; }
  .login-code { margin: 24px 0 0; }
  .login-code strong { max-width: none; font-size: 22px; }
  .login-signal { display: none; }
  .login-panel { padding: 32px 24px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
