/* 管理后台样式: 深蓝科技风(与驾驶舱大屏风格一致) */
:root {
  --bg: #0a1626;
  --panel: #10253d;
  --panel-soft: #0d1f34;
  --border: #1d3a5c;
  --primary: #29c3f0;
  --text: #d7e6f7;
  --text-dim: #7b96b5;
  --success: #35e0c8;
  --danger: #ff6b6b;
  --warn: #ffc266;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 14px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: linear-gradient(90deg, #0d2138, #12304f);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__title h1 {
  margin: 0;
  font-size: 18px;
  color: #fff;
}

.topbar__sub {
  font-size: 12px;
  color: var(--text-dim);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- 按钮与状态 ---------- */
.btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #06202e;
  font-weight: 700;
}

.btn--primary:hover {
  background: #4fd2f7;
  color: #06202e;
}

.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
}

.state-tag {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.state-tag--running {
  color: var(--success);
  border-color: rgba(53, 224, 200, 0.5);
  background: rgba(53, 224, 200, 0.1);
}

.state-tag--paused {
  color: var(--warn);
  border-color: rgba(255, 194, 102, 0.5);
  background: rgba(255, 194, 102, 0.1);
}

.state-tag--idle {
  color: var(--text-dim);
  border-color: var(--border);
}

/* ---------- 卡片与表格 ---------- */
main {
  padding: 20px 24px 48px;
  display: grid;
  gap: 18px;
}

.card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(41, 195, 240, 0.06);
  border-bottom: 1px solid var(--border);
}

.card__header h2 {
  margin: 0;
  font-size: 15px;
  color: #fff;
}

.card__hint {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.table th,
.table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(29, 58, 92, 0.6);
  font-size: 13px;
}

.table th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
}

.table tbody tr:hover {
  background: rgba(41, 195, 240, 0.05);
}

.table .td-name {
  color: #fff;
  font-weight: 600;
}

.table .td-desc {
  color: var(--text-dim);
  max-width: 320px;
  white-space: normal;
}

.table .td-actions {
  display: flex;
  gap: 8px;
}

.th-actions {
  width: 200px;
}

/* 状态点 */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot--success { background: var(--success); }
.dot--error { background: var(--danger); }
.dot--idle { background: #4a6584; }
.dot--ready { background: var(--primary); }
.dot--pending { background: var(--warn); }

.status-text--success { color: var(--success); }
.status-text--error { color: var(--danger); }
.status-text--idle { color: var(--text-dim); }
.status-text--ready { color: var(--primary); }
.status-text--pending { color: var(--warn); }

/* 开关 */
.switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #2a4761;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch--on {
  background: var(--primary);
}

.switch--on::after {
  transform: translateX(16px);
}

/* ---------- 日志 ---------- */
.log-list {
  margin: 0;
  padding: 8px 16px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.9;
}

.log-list li {
  color: var(--text-dim);
  border-bottom: 1px dashed rgba(29, 58, 92, 0.5);
}

.log-list .log--info .log-scope { color: var(--primary); }
.log-list .log--warn { color: var(--warn); }
.log-list .log--error { color: var(--danger); }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 12, 22, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden,
.toast.hidden {
  display: none;
}

.modal__panel {
  width: min(860px, 92vw);
  max-height: 82vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

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

.modal__header h3 {
  margin: 0;
  font-size: 14px;
  color: #fff;
}

.modal__body {
  margin: 0;
  padding: 16px;
  overflow: auto;
  font-size: 12px;
  font-family: Consolas, monospace;
  color: #a9d8ef;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 20px;
  border-radius: var(--radius);
  background: #12304f;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 13px;
  z-index: 200;
}
