:root {
  color-scheme: dark;
  --bg: #080d17;
  --bg-2: #0b1220;
  --panel: #0f1a2c;
  --panel-2: #121f35;
  --line: #1e2d47;
  --line-soft: #17243a;
  --text: #e7eefb;
  --muted: #8fa2bf;
  --faint: #64748b;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, .14);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, .14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .14);
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(56, 189, 248, .08), transparent 60%),
    radial-gradient(800px 500px at 0% 100%, rgba(34, 197, 94, .05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #7dd3fc; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 24px; letter-spacing: -.02em; }
h2 { margin-bottom: 4px; font-size: 17px; letter-spacing: -.01em; }
code, .mono { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.grow { flex: 1; min-width: 180px; }

.layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  background: linear-gradient(180deg, rgba(15, 26, 44, .96), rgba(8, 13, 23, .96));
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white; font-size: 13px; font-weight: 800; letter-spacing: .04em;
  box-shadow: 0 8px 20px rgba(14, 165, 233, .3);
}
.brand-mark.big { width: 54px; height: 54px; border-radius: 16px; font-size: 16px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: .02em; }
.brand-text small { color: var(--faint); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: 13px; transition: .15s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active {
  color: #e0f2fe; background: linear-gradient(90deg, rgba(14,165,233,.18), rgba(14,165,233,.06));
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-icon { width: 18px; text-align: center; color: var(--faint); font-size: 15px; }
.nav-item.active .nav-icon { color: var(--accent); }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.account { display: flex; gap: 10px; align-items: center; padding: 4px 6px 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(56, 189, 248, .12); color: var(--accent); font-weight: 700;
}
.account strong { display: block; font-size: 13px; }
.account small { display: block; color: var(--faint); font-size: 11px; }
.sidebar-actions { display: flex; justify-content: space-between; align-items: center; padding: 0 6px; }
.text-link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; }
.text-link:hover { color: var(--accent); }
.text-link.danger:hover { color: var(--red); }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  padding: 26px 34px 20px; border-bottom: 1px solid var(--line-soft);
}
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 5px; }
.topbar h1 { font-size: 26px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 26px 34px 34px; max-width: 1500px; }
.footer { color: var(--faint); font-size: 11px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); font-size: 13px;
}
.flash-success { border-color: rgba(34,197,94,.35); background: var(--green-soft); color: #bbf7d0; }
.flash-error { border-color: rgba(248,113,113,.35); background: var(--red-soft); color: #fecaca; }
.flash-warning { border-color: rgba(251,191,36,.35); background: var(--amber-soft); color: #fde68a; }

.card {
  background: linear-gradient(180deg, rgba(18, 31, 53, .82), rgba(12, 21, 37, .9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card, .grid-2 + .card, .stat-grid + .card, .card + .grid-2 { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.card-head p { margin-bottom: 0; font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
.grid-sidebar { grid-template-columns: minmax(0, 1.5fr) minmax(320px, .7fr); }
.sticky-card { position: sticky; top: 22px; }
.narrow { max-width: 560px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card {
  background: linear-gradient(180deg, rgba(18,31,53,.8), rgba(10,18,32,.9));
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 15px 16px; display: flex; flex-direction: column; gap: 2px;
}
.stat-card.accent-green { border-color: rgba(34,197,94,.28); }
.stat-card.accent-red { border-color: rgba(248,113,113,.24); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 28px; line-height: 1.2; letter-spacing: -.03em; }
.stat-hint { color: var(--faint); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--faint); font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; padding: 0 10px 9px; white-space: nowrap;
}
td { padding: 11px 10px; border-top: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: rgba(255,255,255,.018); }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }

.badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 8px; font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-unused { color: #bae6fd; background: rgba(14,165,233,.12); border-color: rgba(14,165,233,.25); }
.badge-active { color: #bbf7d0; background: var(--green-soft); border-color: rgba(34,197,94,.28); }
.badge-expired { color: #fde68a; background: var(--amber-soft); border-color: rgba(251,191,36,.28); }
.badge-revoked { color: #fecaca; background: var(--red-soft); border-color: rgba(248,113,113,.28); }

.empty { color: var(--muted); text-align: center; padding: 34px 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); font-size: 13px; }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { display: flex; gap: 10px; position: relative; }
.timeline-dot { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(56,189,248,.1); flex: none; }
.timeline-title { font-size: 12px; font-weight: 600; }
.timeline-item .small { color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: rgba(255,255,255,.012); }
.step > span { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; padding-top: 2px; }
.step strong { display: block; font-size: 13px; margin-bottom: 2px; }
.step p { margin: 0; color: var(--muted); font-size: 12px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row > .field { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: 12px; }
.field em { color: var(--red); font-style: normal; }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; color: var(--text); background: rgba(5, 11, 21, .72);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: rgba(56,189,248,.65); box-shadow: 0 0 0 3px rgba(56,189,248,.1); }
textarea { resize: vertical; min-height: 72px; }
input:disabled { color: var(--faint); background: rgba(255,255,255,.02); }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.check input { accent-color: var(--accent); }
.checks { align-items: center; gap: 22px; }
.hint { color: var(--faint); font-size: 11px; margin: 14px 0 0; line-height: 1.7; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 14px;
  background: rgba(255,255,255,.035); color: var(--text); font-size: 13px;
  transition: .15s ease; white-space: nowrap;
}
.btn:hover { border-color: rgba(56,189,248,.4); color: #e0f2fe; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #0284c7, #0ea5e9); border-color: transparent; color: white; font-weight: 600; box-shadow: 0 8px 18px rgba(14,165,233,.18); }
.btn-primary:hover { background: linear-gradient(135deg, #0ea5e9, #38bdf8); color: white; }
.btn-ghost { background: transparent; }
.btn-danger { color: #fecaca; border-color: rgba(248,113,113,.3); background: var(--red-soft); }
.btn-danger:hover { border-color: rgba(248,113,113,.6); color: white; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 7px; }
.btn-block { width: 100%; }
.inline-form { display: inline; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.action-row.center { justify-content: center; }
.copy-icon { border: 0; background: transparent; color: var(--faint); padding: 0 4px; font-size: 13px; }
.copy-icon:hover { color: var(--accent); }
.strong-link { color: var(--text); font-weight: 600; }
.strong-link:hover { color: var(--accent); }

.credentials-card { border-color: rgba(56,189,248,.22); }
.credential-grid { display: grid; grid-template-columns: 1fr 1.35fr; gap: 20px; }
.credential { min-width: 0; }
.credential-label { display: block; color: var(--faint); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 5px; }
.credential-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.credential-row code { overflow-wrap: anywhere; color: #bae6fd; font-size: 12px; }
.secret-value { letter-spacing: .04em; }
.filter-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-bar .field { min-width: 150px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.detail-grid > div { display: flex; flex-direction: column; gap: 4px; }
.detail-label { color: var(--faint); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.note-box { margin: 16px 0 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: rgba(56,189,248,.06); color: var(--muted); border-radius: 0 8px 8px 0; }

.public-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 16px; }
.public-flash { width: min(520px, 100%); }
.login-shell { width: min(460px, 100%); }
.login-card { background: linear-gradient(180deg, rgba(18,31,53,.92), rgba(10,18,32,.96)); border: 1px solid var(--line); border-radius: 22px; padding: 30px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-brand { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 26px; }
.login-brand h1 { font-size: 22px; margin-bottom: 5px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 12px; }
.login-foot { display: flex; justify-content: center; gap: 9px; margin-top: 18px; color: var(--faint); font-size: 11px; }
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--accent); }
.dot { color: var(--faint); }
.login-note { text-align: center; color: var(--faint); font-size: 11px; margin: 16px 0 0; }

.docs-shell { max-width: 980px; margin: 0 auto; padding: 34px 24px 60px; }
.docs-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.docs-head h1 { font-size: 30px; }
.docs-shell .card { margin-bottom: 16px; }
.code-block {
  background: #050a13; border: 1px solid var(--line); border-radius: 12px;
  padding: 15px; overflow-x: auto; color: #bae6fd; font-size: 12px; line-height: 1.7;
  white-space: pre;
}
.doc-list { margin: 0; padding-left: 20px; color: var(--muted); }
.doc-list li { margin: 7px 0; }
.error-shell { text-align: center; max-width: 540px; padding: 40px 20px; }
.error-code { font-size: 80px; font-weight: 800; line-height: 1; color: rgba(56,189,248,.22); letter-spacing: -.06em; }
.error-shell h1 { margin-top: 10px; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2, .grid-sidebar { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
  .credential-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding-bottom: 14px; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .nav-item { white-space: nowrap; padding: 8px 10px; }
  .sidebar-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; }
  .account { padding: 0; }
  .sidebar-actions { gap: 12px; }
  .topbar { padding: 20px 18px 16px; align-items: flex-start; }
  .topbar h1 { font-size: 22px; }
  .content { padding: 18px; }
  .stat-grid, .stat-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { align-items: stretch; }
  .filter-bar .field { min-width: 100%; }
  .docs-shell { padding: 22px 14px 40px; }
  .docs-head { flex-direction: column; }
}
