:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242a;
  --muted: #68717d;
  --line: #dfe3e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --warn: #ad6f00;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

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

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}

.login-panel p {
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
}

.top-actions,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title.compact {
  margin-top: 24px;
  margin-bottom: 12px;
}

button,
.ghost-button {
  height: 34px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button:hover,
.ghost-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  background: #fff;
  color: var(--accent);
}

.ghost-button:hover {
  color: #fff;
}

.layout {
  padding: 20px 24px 40px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.metrics-panel {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfd;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(460px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.config-panel {
  grid-row: span 3;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

label.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

.status-line {
  min-height: 20px;
  margin-top: 12px;
  color: var(--accent);
}

.status-line.danger {
  color: var(--danger);
}

.admin-panel {
  margin-bottom: 16px;
}

.admin-create {
  align-items: end;
}

.admin-create button {
  width: fit-content;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actions-cell button {
  height: 30px;
  padding: 0 10px;
}

.token-output {
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  overflow: auto;
  background: #fbfcfd;
  color: var(--text);
}

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

.table-wrap {
  overflow: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfd;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  background: #eef2f6;
  color: #344054;
}

.badge.success {
  background: #ecfdf3;
  color: var(--ok);
}

.badge.failed {
  background: #fef3f2;
  color: var(--danger);
}

.badge.skipped {
  background: #fffaeb;
  color: var(--warn);
}

.log-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  margin-top: 12px;
}

.log-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.log-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.empty {
  color: var(--muted);
  padding: 16px 0;
}

@media (max-width: 1180px) {
  .metrics-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .metrics-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    padding: 14px;
  }

  .form-grid,
  .metrics-panel {
    grid-template-columns: 1fr;
  }
}
