:root {
  --bg: #0f1219;
  --panel: #171b24;
  --panel-soft: #1e2430;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --muted: #9ba7bd;
  --accent: #19c4a7;
  --accent-soft: rgba(25, 196, 167, 0.18);
  --danger: #ff5f6d;
  --warning: #f2c14e;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(25, 196, 167, 0.08), transparent 28%),
    linear-gradient(180deg, #11151d 0%, #0b0e14 100%);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 18, 0.9);
  backdrop-filter: blur(12px);
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  padding: 22px;
}

.card {
  background: linear-gradient(180deg, rgba(28, 33, 44, 0.95), rgba(21, 25, 34, 0.95));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 20px;
  height: calc(100vh - 112px);
  position: sticky;
  top: 22px;
  overflow-y: auto;
}

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

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.checkbox-field span {
  color: var(--muted);
  font-size: 13px;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: rgba(25, 196, 167, 0.55);
  box-shadow: 0 0 0 3px rgba(25, 196, 167, 0.12);
}

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

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.primary-btn,
.danger-btn,
.ghost-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
}

.primary-btn {
  background: linear-gradient(135deg, #17c3b2, #2ec4b6);
  color: #081018;
}

.danger-btn {
  background: rgba(255, 95, 109, 0.16);
  color: #ffd8dd;
  border: 1px solid rgba(255, 95, 109, 0.35);
}

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

.ghost-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
}

.help-box {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(25, 196, 167, 0.08);
  border: 1px solid rgba(25, 196, 167, 0.18);
}

.help-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.workspace {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
}

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

.stat-value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 700;
  word-break: break-all;
}

.progress-card {
  padding: 20px;
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.progress-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16c0a4, #3de0c6);
}

.progress-text,
.status-message {
  color: var(--muted);
}

.status-message {
  margin-top: 12px;
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  min-height: 520px;
}

.log-card,
.history-card {
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.log-viewer {
  margin: 0;
  height: 460px;
  overflow: auto;
  padding: 16px;
  background: #0a0d13;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #d7fff8;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.history-list {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow: auto;
}

.history-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.history-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.history-id {
  font-weight: 700;
}

.history-meta,
.history-extra {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.history-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-idle {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.badge-running {
  background: var(--accent-soft);
  color: #7ef3df;
}

.badge-success {
  background: rgba(86, 207, 135, 0.18);
  color: #87f0a9;
}

.badge-failed {
  background: rgba(255, 95, 109, 0.16);
  color: #ffb4bc;
}

@media (max-width: 1200px) {
  .main-layout,
  .content-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }
}
