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

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2e3354;
  --text: #e8eaf0;
  --text2: #8b91b0;
  --primary: #6366f1;
  --primary-hover: #4f52d4;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 8px;
  --sidebar-w: 220px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

.hidden { display: none !important; }

/* ── 登录页 ── */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 40px; width: 380px; }
.login-box h1 { font-size: 24px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.login-box p { color: var(--text2); margin-bottom: 28px; }

/* ── 主布局 ── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── 侧边栏 ── */
.sidebar { width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 20px 20px 16px; font-size: 18px; font-weight: 700; color: var(--primary); border-bottom: 1px solid var(--border); }
.sidebar nav { flex: 1; padding: 12px 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); color: var(--text2); cursor: pointer; margin-bottom: 2px; transition: all 0.15s; text-decoration: none; user-select: none; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }

/* ── 主内容 ── */
.main { flex: 1; overflow-y: auto; padding: 28px 32px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 600; }
.page { }

/* ── 卡片 ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.platform-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.platform-card-header { display: flex; align-items: center; justify-content: space-between; }
.platform-card-name { font-weight: 600; }
.platform-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--bg3); color: var(--text2); }
.platform-card-meta { color: var(--text2); font-size: 12px; }

/* ── 表格 ── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 12px 16px; color: var(--text2); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg3); }
.empty { text-align: center; color: var(--text2); padding: 40px !important; }

/* ── 状态标签 ── */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 10px; border-radius: 20px; font-weight: 500; }
.badge-active { background: #14532d; color: var(--success); }
.badge-paused { background: #451a03; color: var(--warning); }
.badge-success { background: #14532d; color: var(--success); }
.badge-failed { background: #450a0a; color: var(--danger); }
.badge-running { background: #1e1b4b; color: #a5b4fc; }

/* ── 按钮 ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-github { background: #24292e; color: #fff; }
.btn-github:hover { background: #3a3f44; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 5px 8px; background: transparent; color: var(--text2); border: none; cursor: pointer; border-radius: 4px; font-size: 14px; }
.btn-icon:hover { background: var(--bg3); color: var(--text); }
.btn-close { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 18px; padding: 4px; line-height: 1; }
.btn-close:hover { color: var(--text); }

/* ── 表单 ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text2); font-size: 13px; }
.form-hint { margin-top: 4px; color: var(--text2); font-size: 12px; }
input, select, textarea { width: 100%; padding: 8px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none; transition: border-color 0.15s; font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b91b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea { resize: vertical; }
.select { padding: 7px 32px 7px 12px; min-width: 180px; }

/* ── 弹窗 ── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-box { position: relative; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; width: 480px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-box-lg { width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── 日志 ── */
.log-pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-size: 12px; font-family: 'SF Mono', 'Fira Code', monospace; white-space: pre-wrap; word-break: break-all; color: #a5f3fc; max-height: 400px; overflow-y: auto; }

/* ── Alert ── */
.alert { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 12px; }
.alert-success { background: #14532d33; border: 1px solid var(--success); }
.key-display { font-family: monospace; font-size: 13px; margin: 8px 0; padding: 8px; background: var(--bg); border-radius: 4px; word-break: break-all; color: #a5f3fc; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: var(--radius); font-size: 14px; z-index: 999; animation: slideIn 0.2s ease; }
.toast-success { background: #14532d; border: 1px solid var(--success); color: var(--success); }
.toast-error { background: #450a0a; border: 1px solid var(--danger); color: var(--danger); }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── 操作栏 ── */
.actions { display: flex; gap: 4px; }
