:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #edf5f1;
  --text: #17231f;
  --muted: #65746e;
  --line: #dbe6e1;
  --brand: #176c5f;
  --brand-dark: #0d4f46;
  --warn: #a6531a;
  --shadow: 0 18px 50px rgba(24, 49, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(23, 108, 95, 0.08), transparent 260px),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

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

.admin-app {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 18px;
}

.admin-header p,
.section-label {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-header h1,
.panel h2 {
  margin: 0;
  line-height: 1.15;
}

.admin-header h1 {
  font-size: clamp(26px, 8vw, 38px);
}

.admin-header a {
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  background: rgba(23, 108, 95, 0.1);
  border-radius: 999px;
  padding: 10px 14px;
}

.panel {
  margin-top: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid rgba(23, 108, 95, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.dashboard {
  display: grid;
  gap: 2px;
}

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

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

.field input {
  width: 100%;
  min-height: 48px;
  color: var(--text);
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  padding: 0 14px;
}

.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(23, 108, 95, 0.12);
}

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

.stat-card {
  min-height: 86px;
  padding: 14px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  display: grid;
  align-content: center;
}

.stat-card:nth-child(2) {
  background: #415f86;
}

.stat-card:nth-child(3) {
  background: #7a5a24;
}

.stat-card span {
  font-size: 28px;
  font-weight: 950;
  line-height: 1;
}

.stat-card small {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 850;
  opacity: 0.86;
}

.next-panel {
  display: grid;
  gap: 14px;
}

.next-panel h2 {
  font-size: 22px;
  word-break: break-word;
}

.next-panel span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.action-row,
.tool-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tool-panel {
  grid-template-columns: minmax(120px, 1fr) 1fr 1fr;
  align-items: end;
}

.primary-btn,
.secondary-btn,
.quiet-btn {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 950;
}

.primary-btn {
  color: #fff;
  background: var(--brand);
}

.primary-btn:active {
  background: var(--brand-dark);
}

.secondary-btn {
  color: var(--brand-dark);
  background: var(--surface-soft);
  border: 1px solid rgba(23, 108, 95, 0.18);
}

.quiet-btn {
  color: var(--muted);
  background: #f7faf8;
  border: 1px solid var(--line);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.message.is-error {
  color: #b42318;
}

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

.panel h2 {
  font-size: 19px;
}

.code-list {
  display: grid;
  gap: 8px;
}

.code-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
  background: #f7faf8;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #f9fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.code-row.is-used {
  background: #f1f7f4;
  border-color: rgba(23, 108, 95, 0.22);
}

.code-row strong {
  display: block;
  font-size: 17px;
  line-height: 1.15;
  word-break: break-word;
}

.code-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.copy-small {
  min-width: 72px;
  min-height: 40px;
  color: var(--brand-dark);
  background: #e7f2ee;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 950;
}

.copy-small.is-bound {
  color: #0d4f46;
  background: #d9eee7;
}

@media (max-width: 560px) {
  .admin-app {
    padding-left: 12px;
    padding-right: 12px;
  }

  .admin-header {
    align-items: flex-end;
  }

  .panel {
    padding: 14px;
  }

  .action-row,
  .tool-panel {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    min-height: 78px;
    padding: 12px;
  }

  .stat-card span {
    font-size: 24px;
  }
}
