:root {
  color-scheme: light;
  --ink: #1c2733;
  --muted: #6c7884;
  --line: #dbe2e8;
  --soft: #f4f7f9;
  --panel: #ffffff;
  --accent: #1d6f68;
  --accent-dark: #15534e;
  --danger: #b84b42;
  --shadow: 0 16px 40px rgba(25, 42, 57, .08);
}
* { box-sizing: border-box; }
body { margin: 0; background: #edf2f4; color: var(--ink); font-family: "Microsoft YaHei", "Segoe UI", sans-serif; font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 226px; flex: 0 0 226px; background: #193238; color: #f8fbfb; display: flex; flex-direction: column; padding: 24px 16px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 28px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; font-weight: 700; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: 0; }
.brand div span { margin-top: 3px; color: #a9c0c0; font-size: 12px; }
.nav { display: grid; gap: 4px; }
.nav-item { border: 0; background: transparent; color: #b7c8c9; text-align: left; padding: 11px 12px; border-radius: 6px; }
.nav-item:hover, .nav-item.active { background: #284b50; color: #fff; }
.sidebar-note { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #9fb3b5; font-size: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #d0903e; }
.dot.connected { background: #6ac08e; }
.main { flex: 1; min-width: 0; padding: 30px 38px 56px; }
.topbar { max-width: 1240px; margin: 0 auto 26px; display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: 0; }
h2 { font-size: 17px; letter-spacing: 0; }
.primary, .ghost, .danger { border: 1px solid transparent; border-radius: 6px; padding: 9px 14px; white-space: nowrap; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.ghost:hover { border-color: #aebcc3; background: var(--soft); }
.danger { background: #fff6f5; color: var(--danger); border-color: #e8c0bc; }
.view { max-width: 1240px; margin: 0 auto; }
.hidden { display: none !important; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 15px 17px; box-shadow: var(--shadow); }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font-size: 24px; font-weight: 650; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-head p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; }
input, select { min-height: 38px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); padding: 8px 10px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,111,104,.12); }
#search-input { width: 250px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 840px; }
th, td { padding: 14px 22px; border-bottom: 1px solid #edf0f2; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: #fbfcfc; }
tbody tr:last-child td { border-bottom: 0; }
.user-cell strong, .user-cell span { display: block; }
.user-cell span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.subtle { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 12px; background: #eef3f4; color: #53656a; }
.status.active { background: #e6f4ee; color: #24704d; }
.status.issued { background: #eef0f8; color: #526099; }
.status.expired { background: #fff3df; color: #98621e; }
.status.revoked { background: #fae9e7; color: #9c3f39; }
.actions { display: flex; justify-content: flex-end; gap: 6px; }
.action { border: 0; background: transparent; color: var(--accent-dark); padding: 5px 4px; font-size: 12px; }
.action:hover { text-decoration: underline; }
.action.revoke { color: var(--danger); }
.align-right { text-align: right; }
.empty { padding: 44px 20px; color: var(--muted); text-align: center; }
.settings-panel { max-width: 680px; }
.settings-form { display: grid; gap: 16px; padding: 22px; }
label { display: grid; gap: 7px; color: #4d5b65; font-size: 12px; font-weight: 600; }
.form-actions, .dialog-actions { display: flex; gap: 8px; align-items: center; }
.form-hint { min-height: 20px; padding: 0 22px 22px; color: var(--muted); font-size: 12px; }
dialog { width: min(560px, calc(100vw - 28px)); border: 0; padding: 0; border-radius: 8px; box-shadow: 0 24px 80px rgba(15, 30, 40, .25); }
dialog::backdrop { background: rgba(18, 31, 38, .45); }
.dialog-card { padding: 22px; }
.dialog-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 20px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; padding: 0 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.dialog-actions { justify-content: flex-end; margin-top: 22px; }
.result-box { margin-top: 18px; padding: 14px; border: 1px solid #b7d9cd; border-radius: 6px; background: #f0faf5; color: #245d49; }
.result-box code { display: block; margin-top: 8px; font-size: 16px; letter-spacing: .08em; user-select: all; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 11px 14px; border-radius: 6px; background: #20363b; color: #fff; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 860px) {
  .sidebar { width: 72px; flex-basis: 72px; padding: 18px 8px; }
  .brand { justify-content: center; padding: 0 0 24px; }
  .brand div, .nav-item { font-size: 0; }
  .nav-item { text-align: center; padding: 12px 4px; }
  .sidebar-note { justify-content: center; padding: 10px 0; }
  .sidebar-note span:last-child { display: none; }
  .main { padding: 24px 16px 44px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { align-items: stretch; flex-direction: column; }
  .toolbar { width: 100%; }
  #search-input { width: 100%; }
}
@media (max-width: 520px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar .primary { align-self: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}
