:root {
  --bg: #0a1018;
  --panel: #111b28;
  --line: rgba(255, 255, 255, 0.08);
  --text: #edf3fb;
  --muted: #8da2ba;
  --accent: #4da2ff;
  --accent-2: #7bf0c8;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  --radius: 18px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(77, 162, 255, 0.18), transparent 30%),
    radial-gradient(circle at bottom left, rgba(123, 240, 200, 0.12), transparent 22%),
    var(--bg);
}

.admin-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell { width: min(100%, 500px); }

.login-card,
.panel,
.detail-card,
.chart-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card { padding: 36px; }

.hero-mark,
.brand-kicker,
.pill,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.hero-mark,
.brand-kicker,
.pill {
  background: rgba(77, 162, 255, 0.14);
  color: #8ec5ff;
  padding: 8px 12px;
}

.login-card h1,
.topbar h1,
.panel h2 {
  margin: 14px 0 10px;
}

.login-card p,
.muted-text,
.detail-body,
.config-value,
.bars-empty,
.login-tip { color: var(--muted); }

.error-text { color: #ffc4ce; }

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

.login-form input,
.create-form input,
.create-form textarea,
.create-form select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
}

.file-picker {
  border: 1px dashed rgba(141, 162, 186, 0.5);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.file-picker input {
  padding: 0;
  border: 0;
  background: transparent;
}

.create-form textarea {
  min-height: 110px;
  resize: vertical;
}

.create-form textarea:last-of-type {
  min-height: 80px;
}

button {
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), #2e7dfd);
  color: white;
}

.ghost-button {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}

.danger-button {
  color: #ffc4ce;
  border-color: rgba(255, 122, 144, 0.32);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.login-error {
  background: rgba(255, 122, 144, 0.14);
  color: #ffc4ce;
  border: 1px solid rgba(255, 122, 144, 0.3);
  padding: 12px 14px;
  border-radius: 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: rgba(8, 13, 21, 0.74);
  backdrop-filter: blur(18px);
}

.brand-title {
  font-size: 30px;
  font-weight: 800;
  margin-top: 14px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}

.sidebar-nav a:hover { background: rgba(77, 162, 255, 0.12); }

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.content {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.topbar,
.panel-head,
.jobs-layout,
.form-row {
  display: flex;
  gap: 16px;
}

.topbar,
.panel-head {
  align-items: center;
  justify-content: space-between;
}

.panel { padding: 22px; }

.summary-grid,
.chart-grid,
.config-grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 18px;
}

.chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 18px;
}

.summary-card,
.config-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255,255,255,0.03);
}

.summary-value {
  font-size: 34px;
  font-weight: 800;
  margin-top: 8px;
}

.bars {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

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

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.jobs-layout {
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 18px;
}

.inline-head {
  margin-top: 24px;
}

.table-shell {
  flex: 1 1 720px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.is-active {
  background: rgba(77, 162, 255, 0.08);
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.status-pill.queued { background: rgba(255, 180, 84, 0.14); color: #ffd39f; }
.status-pill.running { background: rgba(77, 162, 255, 0.14); color: #92c7ff; }
.status-pill.succeeded { background: rgba(123, 240, 200, 0.14); color: #abfadd; }
.status-pill.failed { background: rgba(255, 122, 144, 0.14); color: #ffc4ce; }
.status-pill.active { background: rgba(123, 240, 200, 0.14); color: #abfadd; }
.status-pill.cooling { background: rgba(255, 180, 84, 0.16); color: #ffd39f; }
.status-pill.verification_required { background: rgba(255, 180, 84, 0.16); color: #ffd39f; }
.status-pill.disabled { background: rgba(255,255,255,0.08); color: #c7d4e2; }

.power-cell {
  min-width: 180px;
}

.power-cell .muted-text,
.power-cell .error-text {
  margin-top: 4px;
  font-size: 12px;
}

.detail-card {
  width: min(100%, 360px);
  padding: 18px;
}

.detail-body {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.7;
}

.config-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: 18px;
}

.config-key {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.config-value {
  margin-top: 10px;
  word-break: break-all;
}

.code-block {
  margin: 14px 0 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.form-row {
  flex-wrap: wrap;
}

.form-row > * {
  flex: 1 1 220px;
}

.form-actions { align-items: center; }

a { color: #8ec5ff; }

code { font-family: Consolas, "Courier New", monospace; }

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

.table-actions button {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
