:root {
  --bg: #f4f4f5;
  --panel: #fff;
  --text: #101116;
  --muted: #667085;
  --line: #dedfe3;
  --dark: #17171d;
  --accent: #0f766e;
  --soft: #f7f7f8;
  --shadow: 0 10px 26px rgba(16, 17, 22, 0.06);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button,
a {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}

button.primary {
  color: #fff;
  background: var(--dark);
  border-color: var(--dark);
}

.admin-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar nav,
.button-row {
  display: flex;
  gap: 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 12px 14px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 5px;
  font-size: 19px;
  line-height: 1.2;
}

.grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  padding: 14px;
  margin-bottom: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.panel-title span,
#keyStatus {
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

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

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-size: 13px;
}

input:focus,
select:focus {
  border-color: var(--dark);
  box-shadow: 0 0 0 3px rgba(23, 23, 29, 0.08);
}

.button-row {
  margin-top: 12px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 8px 7px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

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

td input {
  height: 30px;
  background: #fff;
  font-size: 12px;
}

td input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.row-action {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.result-link {
  color: var(--accent);
  border: 0;
  background: transparent;
  padding: 0;
  height: auto;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(16px);
  max-width: 420px;
  padding: 11px 15px;
  color: #fff;
  background: var(--dark);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.login-page {
  min-width: 0;
}

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

.login-card {
  width: min(360px, 100%);
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
}

.login-card p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-card label {
  display: block;
  margin-bottom: 12px;
}

.login-button {
  width: 100%;
  margin-top: 4px;
}
