:root {
  color-scheme: dark;
  --bg: #061623;
  --bg-2: #082133;
  --panel: #0e1c2d;
  --panel-2: #10263a;
  --line: rgba(132, 170, 207, 0.22);
  --line-strong: rgba(132, 170, 207, 0.34);
  --text: #f2f7ff;
  --muted: #9eb9d2;
  --muted-2: #6f8fa9;
  --accent: #18d5c2;
  --accent-2: #6ca8ff;
  --danger: #ff8c75;
  --warning: #ffd178;
  --success: #66e5b0;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 70% 10%, rgba(24, 213, 194, 0.12), transparent 28%),
    linear-gradient(180deg, #061827 0%, var(--bg) 48%, #07131e 100%);
  color: var(--text);
}

button, input, textarea, select { font: inherit; }
a { color: #9ed8ff; text-decoration: none; }
code { font-family: Consolas, "Courier New", monospace; }

.page {
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  margin-bottom: 22px;
}

h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.25;
}

.panel-subtitle {
  margin-top: 26px;
  font-size: 18px;
}

.sub {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.sub code,
.hint code {
  padding: 3px 7px;
  border-radius: 7px;
  color: #d9f5ff;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(132, 170, 207, 0.18);
}

.nav,
.tabs,
.row,
.section-head,
.jobs-layout {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav {
  justify-content: flex-end;
  align-items: center;
  min-width: 360px;
}

.btn,
.tab-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.btn:hover,
.tab-btn:hover {
  border-color: rgba(24, 213, 194, 0.45);
  background: rgba(24, 213, 194, 0.08);
}

.btn:disabled,
.tab-btn:disabled {
  cursor: wait;
  opacity: 0.62;
}

.btn.primary,
.tab-btn.active {
  color: #041b1b;
  border-color: var(--accent);
  background: var(--accent);
  font-weight: 800;
}

.btn.danger {
  color: #ffd3cc;
}

.tabs {
  padding-bottom: 8px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(132, 170, 207, 0.16);
}

.tab-btn {
  min-width: 116px;
  font-weight: 800;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 18px;
  margin: 18px 0 18px;
}

.metric,
.panel,
.detail-card {
  background: linear-gradient(180deg, rgba(19, 47, 71, 0.78), rgba(12, 27, 43, 0.9));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 92px;
  padding: 18px 20px;
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0;
}

.metric span {
  color: #9ec6ee;
  font-size: 14px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.panel {
  padding: 24px;
  margin-bottom: 18px;
}

.hint {
  margin: -6px 0 18px;
  color: var(--muted);
  line-height: 1.65;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.field.compact {
  flex: 1 1 160px;
  min-width: 150px;
}

.field label,
.checkbox {
  color: #9fc3e4;
  font-size: 13px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.checkbox input[type="number"] {
  width: 92px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(2, 10, 18, 0.78);
  padding: 12px 13px;
}

textarea {
  min-height: 98px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(24, 213, 194, 0.7);
  box-shadow: 0 0 0 3px rgba(24, 213, 194, 0.14);
}

.row {
  align-items: center;
}

.row > input {
  flex: 1 1 260px;
}

.section-head {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
}

.muted,
.status,
.bars-empty,
.detail-body,
.config-value {
  color: var(--muted);
}

.status {
  min-height: 24px;
  margin-top: 10px;
  white-space: pre-wrap;
  font-size: 13px;
}

.status.ok { color: var(--success); }
.status.err { color: var(--danger); }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  background: rgba(4, 13, 23, 0.42);
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(132, 170, 207, 0.14);
  font-size: 13px;
}

th {
  color: #a9c8e5;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 800;
}

tbody tr { cursor: pointer; }
tbody tr:hover,
tbody tr.is-active { background: rgba(24, 213, 194, 0.07); }

.mini,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
}

.mini {
  color: #9fc3e4;
  background: rgba(255, 255, 255, 0.04);
}

.status-pill.active,
.status-pill.succeeded {
  color: #9ef0ca;
  border-color: rgba(102, 229, 176, 0.35);
  background: rgba(102, 229, 176, 0.12);
}

.status-pill.queued {
  color: #ffe0a8;
  border-color: rgba(255, 209, 120, 0.35);
  background: rgba(255, 209, 120, 0.12);
}

.status-pill.running {
  color: #abd3ff;
  border-color: rgba(108, 168, 255, 0.4);
  background: rgba(108, 168, 255, 0.12);
}

.status-pill.failed,
.status-pill.disabled {
  color: #ffc2b6;
  border-color: rgba(255, 140, 117, 0.35);
  background: rgba(255, 140, 117, 0.12);
}

.status-pill.verification_required {
  color: #ffe0a8;
  border-color: rgba(255, 209, 120, 0.35);
  background: rgba(255, 209, 120, 0.12);
}

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

.table-actions .btn {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.usage-cell {
  min-width: 230px;
  display: grid;
  gap: 9px;
}

.usage-line {
  display: grid;
  gap: 5px;
}

.usage-meta,
.usage-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #a9c8e5;
  font-size: 12px;
}

.usage-meta strong {
  color: var(--text);
}

.usage-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

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

.usage-fill.warning {
  background: linear-gradient(90deg, #ffd178, #ffad66);
}

.usage-fill.danger {
  background: linear-gradient(90deg, #ff8c75, #ff5f7d);
}

.usage-reset,
.usage-footer {
  color: var(--muted-2);
  font-size: 12px;
}

.usage-error {
  color: var(--danger);
  font-weight: 800;
}

.jobs-layout {
  align-items: flex-start;
}

.jobs-table-wrap {
  flex: 1 1 760px;
}

.detail-card {
  flex: 0 0 390px;
  padding: 18px;
}

.eyebrow {
  margin-bottom: 10px;
  color: #8fb5d7;
  font-size: 12px;
  text-transform: uppercase;
}

.detail-body {
  max-height: 620px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 13px;
}

.bars {
  display: grid;
  gap: 12px;
}

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

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #a9c8e5;
  font-size: 13px;
}

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

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

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.config-card {
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(2, 10, 18, 0.38);
}

.config-key {
  color: #9fc3e4;
  font-size: 12px;
  font-weight: 800;
}

.config-value {
  margin-top: 9px;
  word-break: break-all;
  line-height: 1.55;
}

.code-block {
  margin: 14px 0 0;
  padding: 13px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid rgba(132, 170, 207, 0.18);
  border-radius: 10px;
  color: #d9f5ff;
  background: rgba(0, 0, 0, 0.24);
}

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

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

.login-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(19, 47, 71, 0.82), rgba(12, 27, 43, 0.96));
  box-shadow: var(--shadow);
}

.hero-mark {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  color: #93fff0;
  background: rgba(24, 213, 194, 0.12);
  border: 1px solid rgba(24, 213, 194, 0.24);
}

.login-card h1 {
  margin-top: 16px;
}

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

.login-error {
  padding: 11px 12px;
  border-radius: 10px;
  color: #ffd4cc;
  background: rgba(255, 140, 117, 0.12);
  border: 1px solid rgba(255, 140, 117, 0.26);
}

@media (max-width: 980px) {
  .page { width: min(100% - 24px, 1460px); padding-top: 18px; }
  .topbar { flex-direction: column; }
  .nav { min-width: 0; justify-content: flex-start; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .detail-card { flex-basis: 100%; }
}

@media (max-width: 560px) {
  h1 { font-size: 28px; }
  .summary { grid-template-columns: 1fr; }
  .metric strong { font-size: 32px; }
}
