* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "SF Pro Display", "Segoe UI", sans-serif;
  color: #20312a;
  background: #eff5f2;
}
.hidden { display: none !important; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, #5b9e86, #86c4ad);
}
.login-shell {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(circle at 10% 12%, rgba(91,158,134,.18), transparent 38%),
    radial-gradient(circle at 92% 16%, rgba(112,162,255,.12), transparent 36%),
    #eff5f2;
}
.login-card {
  width: min(420px, calc(100% - 24px));
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(0,0,0,.05);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(19, 38, 31, 0.09);
}
.login-card h1 { margin: 18px 0 8px; font-size: 26px; }
.login-card p { margin: 0 0 16px; color: #5f7068; line-height: 1.65; font-size: 14px; }
.login-card label { display: block; margin: 12px 0 6px; font-size: 13px; color: #4d5f56; }
.login-card input {
  width: 100%; height: 42px; border-radius: 10px; border: 1px solid #dfe8e4;
  background: #fbfdfc; padding: 0 12px; outline: none; font-size: 14px;
}
.login-card input:focus { border-color: #8dbdaa; box-shadow: 0 0 0 3px rgba(91,158,134,0.12); }
.login-card button {
  width: 100%; height: 44px; margin-top: 16px; border: 0; border-radius: 12px;
  background: #5b9e86; color: #fff; font-weight: 700; cursor: pointer;
  box-shadow: 0 10px 20px rgba(91,158,134,0.25);
}
.error { min-height: 22px; margin-top: 8px; color: #d33f3f; font-size: 13px; }

.dashboard {
  display: grid; grid-template-columns: 220px 1fr; min-height: 100vh;
}
.sidebar {
  background: #1f2e28;
  color: #dce9e2;
  padding: 16px 14px;
  display: flex; flex-direction: column;
}
.sidebar nav { margin-top: 18px; display: grid; gap: 8px; }
.nav-btn {
  height: 40px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  background: transparent; color: inherit; text-align: left; padding: 0 12px; cursor: pointer;
}
.nav-btn.active, .nav-btn:hover { background: rgba(107, 188, 156, 0.15); border-color: rgba(107,188,156,.22); }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; font-size: 13px; }
.sidebar-footer .ghost {
  height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12);
  background: transparent; color: #edf4f0; cursor: pointer;
}
.sidebar-footer a { color: #a8cabb; }

.content { padding: 18px; }
.content-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.content-head h2 { margin: 0; font-size: 26px; }
.subtitle { color: #61736a; font-size: 13px; margin-top: 4px; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.head-actions select, .head-actions button {
  height: 38px; border-radius: 10px; border: 1px solid #dfe7e3; background: #fff;
  padding: 0 12px; font-size: 13px;
}
.head-actions button { cursor: pointer; font-weight: 600; }

.panel {
  background: #fff; border: 1px solid rgba(20,35,29,.05);
  border-radius: 16px; padding: 14px;
  box-shadow: 0 12px 26px rgba(17, 31, 26, .04);
  margin-bottom: 14px;
}
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.panel.split {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 14px;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card {
  border-radius: 14px; background: linear-gradient(180deg, #fafdfb, #f5faf7);
  border: 1px solid #e8efeb; padding: 14px;
}
.stat-card .k { color: #64766d; font-size: 13px; }
.stat-card .v { font-size: 28px; font-weight: 700; margin-top: 6px; }
.code-list { display: grid; gap: 8px; }
.code-list code {
  display: block; background: #f4f8f6; color: #32584a; border-radius: 10px; padding: 10px;
  font-size: 12px; overflow: auto;
}
.tips { margin: 0; padding-left: 18px; color: #52645b; line-height: 1.9; font-size: 14px; }

.table-wrap { overflow: auto; border: 1px solid #edf1ef; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
thead th {
  text-align: left; padding: 10px; font-size: 12px; color: #65786f; background: #f7faf8;
  border-bottom: 1px solid #edf1ef; white-space: nowrap;
}
tbody td { padding: 8px 10px; border-bottom: 1px solid #f0f3f1; font-size: 13px; vertical-align: top; }
tbody tr:hover { background: #fbfdfc; }
.tag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 58px; height: 24px; border-radius: 999px; padding: 0 8px;
  font-size: 12px; font-weight: 600;
  border: 0;
}
.tag.vip { background: #e8f7ef; color: #2f8c61; }
.tag.normal { background: #f4f4f4; color: #7f7f7f; }
.tag.prod, .tag.production { background: #e8f7ef; color: #2f8c61; }
.tag.sandbox { background: #eef2ff; color: #4b64c8; }
.tag.unknown { background: #f4f4f4; color: #7f7f7f; }
.tag.member-toggle { cursor: pointer; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.token-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-btn {
  height: 26px;
  border: 1px solid #d8e6df;
  border-radius: 999px;
  background: #f7faf9;
  color: #2f6d55;
  font-size: 12px;
  cursor: pointer;
  padding: 0 10px;
  line-height: 1;
}
.mini-btn:hover { background: #eaf5f0; }
.mini-btn:disabled { opacity: .7; cursor: wait; }
.mini-btn.danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fef2f2;
}
.mini-btn.danger:hover {
  background: #fee2e2;
}

/* 扁平化表单控件（表格内） */
tbody input[type="text"],
tbody input[type="number"],
tbody select {
  width: 100%;
  box-sizing: border-box;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  padding: 0 6px;
  font-size: 12px;
  outline: none;
  background: #fcfdfd;
}
tbody input[type="text"]:focus,
tbody input[type="number"]:focus,
tbody select:focus {
  border-color: #5b9e86;
  box-shadow: 0 0 0 2px rgba(91,158,134,0.16);
}
tbody input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.switch-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid #d1fae5;
  background: #ecfdf5;
  color: #047857;
}
.switch-pill.off {
  border-color: #e4e4e7;
  background: #fafafa;
  color: #71717a;
}

.event-list { display: grid; gap: 10px; }
.event-item {
  border: 1px solid #ecf0ee; border-radius: 12px; background: #fbfdfc; padding: 12px;
}
.event-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.event-meta { color: #65786f; font-size: 12px; }
.event-payload {
  margin-top: 8px; white-space: pre-wrap; word-break: break-word;
  background: #fff; border: 1px solid #eef1ef; border-radius: 8px; padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  color: #31433b;
}

.calendar-config {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-config-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.calendar-config-toolbar label {
  font-size: 13px;
  color: #4b5b53;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.calendar-config-toolbar input[type="number"],
.calendar-config-toolbar input[type="text"],
.calendar-config-toolbar select {
  height: 32px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  padding: 0 8px;
  font-size: 13px;
}

.calendar-config textarea {
  width: 100%;
  min-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid #d0d5dd;
  padding: 8px;
  resize: vertical;
}

.calendar-config-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-config-actions .primary {
  background: #2563eb;
  color: #fff;
  border-color: transparent;
}

.calendar-config-actions .primary:hover {
  background: #1d4ed8;
}

.calendar-config-actions .hint {
  font-size: 12px;
  color: #64748b;
}

@media (max-width: 980px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; }
  .sidebar nav { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .sidebar-footer { grid-template-columns: 1fr 1fr; }
  .panel.split, .stats-grid { grid-template-columns: 1fr; }
}
