:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(51, 65, 85, 0.7);
  --border-glow: rgba(56, 189, 248, 0.3);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --radius: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  gap: 24px;
}

/* 顶部导航 */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 18px 24px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  letter-spacing: 1px;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.brand-info h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.brand-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.service-indicators {
  display: flex;
  align-items: center;
  gap: 14px;
}

.indicator-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.checking {
  background: var(--accent-orange);
  box-shadow: 0 0 8px var(--accent-orange);
  animation: pulse 1.5s infinite;
}

.status-dot.error {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* 按钮通用 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn.primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  transform: translateY(-1px);
}

.btn.secondary {
  background: rgba(51, 65, 85, 0.6);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn.secondary:hover {
  background: rgba(71, 85, 105, 0.8);
}

.btn.outline {
  background: transparent;
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.btn.outline:hover {
  background: rgba(6, 182, 212, 0.1);
}

.nav-btn.ghost {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.nav-btn.ghost:hover {
  color: #fff;
  border-color: var(--accent-cyan);
}

/* 主内容布局 */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 指标卡片 */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--radius);
  transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.05);
}

.metric-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.metric-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.metric-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.metric-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }

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

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

/* 控制操作卡片 */
.control-panel {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .control-panel {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title h3 {
  font-size: 15px;
  font-weight: 600;
}

.tip-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.8);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.tip-badge code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.card-body {
  padding: 20px;
}

.card-body .desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.result-box {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.result-box.success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.result-box.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.result-box.hidden {
  display: none;
}

/* API 对接速览 */
.api-endpoint-box {
  display: flex;
  align-items: center;
  background: #060b14;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.api-endpoint-box .method {
  background: #1e3a8a;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 12px;
  letter-spacing: 0.5px;
}

.api-endpoint-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e2e8f0;
  outline: none;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--accent-cyan);
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-copy:hover {
  background: rgba(6, 182, 212, 0.2);
}

.api-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.api-tip code {
  color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* 表格组件 */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.count-badge {
  font-size: 12px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
}

.table-search input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  width: 260px;
  outline: none;
}

.table-search input:focus {
  border-color: var(--accent-cyan);
}

.table-container {
  overflow-x: auto;
}

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

.data-table th {
  padding: 12px 16px;
  background: rgba(30, 41, 59, 0.4);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.client-name {
  font-weight: 700;
  color: #fff;
}

.client-contact {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.copy-mini-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
}

.copy-mini-btn:hover {
  color: #fff;
  border-color: var(--accent-cyan);
}

.project-tag {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  display: inline-block;
}

.message-preview {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  cursor: pointer;
}

.message-preview:hover {
  color: #fff;
  text-decoration: underline;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.sent {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.simulated {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.status-pill.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pill.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.table-ops {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-op {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transition: all 0.2s;
}

.btn-op:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}

.loading-row td, .empty-row td {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
}

/* 底部状态 */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-sub);
  padding: 12px 4px;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.app-footer code {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-row label {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-row .value {
  font-size: 14px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.detail-row .value.multiline {
  white-space: pre-wrap;
  line-height: 1.6;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 登录弹窗专用 */
.login-modal-box {
  max-width: 440px;
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(6, 182, 212, 0.2);
}

.login-field input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.login-error-tip {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

