:root {
  --primary: #4f6ef7;
  --primary-dark: #3b56d8;
  --bg: #0f1524;
  --bg-card: #182036;
  --bg-input: #0f1524;
  --border: #2a3550;
  --text: #e6ebf5;
  --text-muted: #8b97b3;
  --success: #34c77b;
  --danger: #f2555a;
  --radius: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ---------- 登录页 ---------- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1b2440 0%, var(--bg) 70%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #7a5cf7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

.logo-badge.small {
  width: 30px;
  height: 30px;
  margin: 0 10px 0 0;
  border-radius: 8px;
  font-size: 15px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 6px;
}

.login-tip {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  margin-top: 16px;
  line-height: 1.6;
}

/* 默认账号一键填入 */
.login-default {
  background: rgba(79, 110, 247, 0.08);
  border: 1px solid rgba(79, 110, 247, 0.35);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: center;
}

.login-default-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.login-default-btn {
  display: inline-block;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.login-default-btn:hover {
  background: rgba(79, 110, 247, 0.15);
  color: #9db4ff;
}

.login-default-tip {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.login-error {
  background: rgba(242, 85, 90, 0.1);
  border: 1px solid rgba(242, 85, 90, 0.4);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  margin-top: 14px;
  line-height: 1.6;
  word-break: break-all;
  white-space: pre-line;
}

/* 登录页 API 地址 */
.login-api {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.login-api-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-align: center;
}

.login-api-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.login-api-item span {
  color: var(--text-muted);
  min-width: 88px;
  flex-shrink: 0;
}

.login-api-item code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: #7fd0ff;
  flex: 1;
  word-break: break-all;
}

/* ---------- 布局 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 58px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-right a {
  color: var(--text-muted);
  text-decoration: none;
}

.topbar-right a:hover {
  color: var(--primary);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .data-table {
    font-size: 14px;
  }
}

/* API 地址横幅 */
.api-banner {
  border-color: rgba(79, 110, 247, 0.4);
  background: linear-gradient(180deg, rgba(79, 110, 247, 0.08), rgba(122, 92, 247, 0.05));
}

/* ---------- 文档弹窗 ---------- */
.doc-body {
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  padding-right: 6px;
}

.doc-body h3 {
  font-size: 15px;
  margin: 22px 0 10px;
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 10px;
}

.doc-body h3:first-child {
  margin-top: 0;
}

.doc-body p {
  margin: 8px 0;
  color: var(--text-muted);
}

.doc-body ul {
  margin: 8px 0 8px 20px;
  color: var(--text-muted);
}

.doc-body li {
  margin: 4px 0;
}

.doc-body pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: #7fd0ff;
  margin: 10px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.doc-body code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: #7fd0ff;
}

.doc-table {
  margin: 10px 0 18px;
}

.doc-table code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12px;
}

/* ---------- 统计卡片 ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 8px;
}

.stat-value.stat-version {
  color: var(--primary);
}

.stat-value.stat-sm {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  word-break: break-all;
}

/* ---------- 面板 ---------- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---------- 表单 ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field .required {
  color: var(--danger);
}

.field-tip {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  border-color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.btn-mini {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-danger {
  color: var(--danger);
}

.status-text {
  margin-left: 12px;
  font-size: 13px;
  color: var(--success);
}

.status-text.error {
  color: var(--danger);
}

/* ---------- 开关 ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: 0.3s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.checkbox-group {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
}

/* ---------- 文件输入 ---------- */
.file-input {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 26px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-input);
}

.file-input:hover,
.file-input.dragover {
  border-color: var(--primary);
  color: var(--text);
}

.file-input input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-input.dragover {
  background: rgba(79, 110, 247, 0.08);
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.data-table tr:hover td {
  background: rgba(79, 110, 247, 0.04);
}

.hash-cell {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.empty-tip {
  text-align: center;
  color: var(--text-muted);
  padding: 30px !important;
}

.actions-cell a {
  color: var(--primary);
  text-decoration: none;
  margin-right: 12px;
  font-size: 13px;
}

.actions-cell a.danger {
  color: var(--danger);
}

.actions-cell a:hover {
  text-decoration: underline;
}

/* ---------- 对接说明 ---------- */
.api-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.api-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

.api-label {
  color: var(--text-muted);
  min-width: 100px;
}

.api-item code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: #7fd0ff;
  flex: 1;
  word-break: break-all;
}

.notice {
  background: rgba(79, 110, 247, 0.06);
  border: 1px solid rgba(79, 110, 247, 0.25);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-muted);
}

.notice code {
  color: #7fd0ff;
  font-family: "SF Mono", Consolas, monospace;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.modal-lg {
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 26px 30px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}
