:root {
  --ink: #101722;
  --side: #304156;
  --side-text: #bfcbd9;
  --side-muted: #8a9bb0;
  --mint: #1ec8b0;
  --blue: #409eff;
  --blue-hover: #337ecc;
  --bg: #eef1f4;
  --card: #fff;
  --line: #e3e7ee;
  --text: #1b2430;
  --muted: #667386;
  --danger: #b42318;
  --ok: #067647;
  --ok-bg: #e7f6ee;
  --warn: #b54708;
  --warn-bg: #fff4e5;
  --shadow: 0 1px 2px rgba(16, 23, 34, 0.04), 0 8px 24px rgba(16, 23, 34, 0.04);
  --radius: 12px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }

#root { min-height: 100%; }

.gate, .auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(30, 200, 176, 0.18), transparent 60%),
    var(--bg);
}

.gate-panel, .auth-card {
  width: min(880px, 100%);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}
.brand-lockup img {
  width: 84px;
  height: 84px;
  border-radius: 20px;
}
.brand-lockup h1 {
  margin: 14px 0 6px;
  font-size: 28px;
  letter-spacing: 0.02em;
}
.brand-lockup p { margin: 0; color: var(--muted); }

.gate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.choice {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.choice:hover { border-color: #b7d7ef; }
.choice strong { display: block; font-size: 18px; margin-bottom: 8px; }
.choice span { display: block; color: var(--muted); line-height: 1.5; font-size: 14px; }
.choice em {
  display: inline-block;
  margin-top: 16px;
  font-style: normal;
  color: var(--blue);
  font-size: 14px;
}
.gate-foot {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}
.auth-card .brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
img.logo-side {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}
img.logo-auth {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}
img.logo-mark {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
}
.auth-card .brand-row img { width: 56px; height: 56px; }
.auth-card h1 { margin: 0; font-size: 20px; }
.auth-card .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.shell {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.side {
  width: 220px;
  flex: 0 0 220px;
  background: var(--side);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 16px;
}
.side-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 8px 18px;
}
.side-brand strong { display: block; color: #fff; font-size: 17px; letter-spacing: 0.04em; font-weight: 600; }
.side-brand span { display: block; color: var(--side-muted); font-size: 12px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  color: var(--side-text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255, 255, 255, 0.05); }
.nav a.active {
  background: rgba(64, 158, 255, 0.15);
  color: #fff;
  border-left-color: var(--blue);
}
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-group-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--side-muted);
}
.auth-foot {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.auth-foot a { color: var(--blue); }
.side-foot {
  margin-top: auto;
  padding: 12px 8px 0;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-foot a { color: var(--side-muted); }

.work { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 18px; font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.who b { color: var(--text); font-weight: 600; }

.content { padding: 16px 20px 32px; max-width: none; flex: 1; }

.lead { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card h2 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.card .mono, .mono {
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
  font-size: 13px;
  word-break: break-all;
}
.card p { margin: 0; line-height: 1.5; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.status-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef1f5;
  color: var(--muted);
}
.pill.on { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: #fdecec; color: var(--danger); }

.toolbar, .filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.filters select, .field input, .field textarea, .field select, .auth-card input {
  width: 100%;
  border: 1px solid #d5dbe3;
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .auth-card input:focus, .filters select:focus {
  outline: 2px solid rgba(14, 125, 204, 0.25);
  border-color: var(--blue);
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.hint, .field .hint { color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 6px; }
.err { display: block; color: var(--danger); font-size: 12px; font-style: normal; margin-top: 6px; }

.btn {
  appearance: none;
  border: 1px solid #d5dbe3;
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { border-color: #b7c3d1; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; white-space: nowrap; }
.btn.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn.tiny { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: #606266; font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.selected { background: #f5f7fa; }
.table-wrap { overflow-x: auto; }
.table-wrap.flush { overflow: visible; }

.page-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}
.panel-toolbar-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.panel-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.toolbar-label { font-size: 13px; color: #606266; white-space: nowrap; }
.select-compact {
  min-width: 120px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 7px 10px;
  background: #fff;
  font-size: 13px;
}
.panel-body { padding: 0; }
.panel-body-padded { padding: 20px 24px 28px; }

table.data-table th,
table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #ebeef5;
}
table.data-table thead th {
  background: #f5f7fa;
  color: #909399;
  font-weight: 600;
}
table.data-table tbody tr:nth-child(even) { background: #fafafa; }
table.data-table tbody tr.selected { background: #ecf5ff !important; }
.col-index { width: 56px; color: #909399; text-align: center; }
.col-actions { width: 88px; text-align: center; white-space: nowrap; }
.col-name { font-weight: 500; color: #303133; min-width: 120px; }
.col-time { white-space: nowrap; color: #606266; font-size: 13px; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 20px;
  border: 1px solid transparent;
}
.tag-success {
  color: #67c23a;
  background: #f0f9eb;
  border-color: #e1f3d8;
}
.tag-info {
  color: #909399;
  background: #f4f4f5;
  border-color: #e9e9eb;
}

.btn-link {
  appearance: none;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}
.btn-link:hover { color: var(--blue-hover); text-decoration: underline; }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state p { margin: 0 0 16px; font-size: 14px; }

.kv.wide { grid-template-columns: 88px 1fr; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 18px; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 8px 10px; font-size: 13px; }
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; word-break: break-all; }

.callout {
  background: #f3fbf9;
  border: 1px solid #c9efe6;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 14px;
}
.callout strong { display: block; margin-bottom: 4px; }
.callout.warn {
  background: var(--warn-bg);
  border-color: #f5ddb8;
}

.banner {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #fdecec;
  color: var(--danger);
}
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }

.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: #d5dbe3;
  padding: 3px;
  cursor: pointer;
  position: relative;
}
.switch i {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.switch.on { background: var(--mint); }
.switch.on i { transform: translateX(18px); }
.switch-line { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.narrow { max-width: 560px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.event-list code { font-size: 12px; }

pre.snippet {
  margin: 0;
  padding: 12px 14px;
  background: #101722;
  color: #e7eef7;
  border-radius: 10px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
}

.mask { position: relative; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: #101722;
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 23, 34, 0.35);
  z-index: 20;
  display: flex;
  justify-content: flex-end;
}
.drawer {
  width: min(440px, 100%);
  height: 100%;
  background: #fff;
  padding: 22px 22px 28px;
  box-shadow: -8px 0 24px rgba(16, 23, 34, 0.08);
  overflow: auto;
}
.drawer h2 { margin: 0 0 6px; font-size: 18px; }
.back-link { color: var(--muted); font-size: 13px; text-decoration: none; }

@media (max-width: 900px) {
  .panel-toolbar { flex-wrap: wrap; }
  .panel-toolbar-actions { width: 100%; justify-content: flex-end; }
  .cards, .gate-grid, .split { grid-template-columns: 1fr; }
  .shell { flex-direction: column; }
  .side { width: 100%; max-width: 100%; flex-basis: auto; min-width: 0; padding-bottom: 8px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 10px; }
  .nav a.active { border-left-color: transparent; border-bottom-color: var(--mint); }
  .side-foot { display: none; }
  .top { height: auto; min-height: 56px; flex-wrap: wrap; padding: 12px 16px; }
  .content { padding-left: 16px; padding-right: 16px; }
  .work { min-width: 0; }
}
