:root {
  --ink: #17212b;
  --muted: #667085;
  --line: #d8e0ea;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --brand: #1f6feb;
  --brand-strong: #1559c7;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b42318;
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eef4f8;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 111, 235, 0.08), rgba(13, 148, 136, 0.08)),
    #eef4f8;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #1f6feb;
  color: #fff;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

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

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

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 224, 234, 0.85);
  border-radius: var(--radius);
  box-shadow: 0 14px 42px rgba(23, 33, 43, 0.08);
  padding: 18px;
}

.section {
  margin-top: 14px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 17px;
}

.hint,
.small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.field label {
  font-weight: 700;
  font-size: 14px;
}

.field .help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

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

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.option input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
  min-height: 44px;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger);
}

.btn.ghost {
  background: transparent;
  color: var(--brand);
  padding: 8px 4px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.stat {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.stat strong {
  display: block;
  font-size: 24px;
}

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

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rank-name {
  font-weight: 800;
}

.badge {
  border-radius: 999px;
  background: #e6f4ef;
  color: #05603a;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
}

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

.bar {
  display: grid;
  grid-template-columns: minmax(80px, 160px) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.track {
  height: 8px;
  border-radius: 999px;
  background: #d8e0ea;
  overflow: hidden;
}

.fill {
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

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

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

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: var(--soft);
  font-weight: 800;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  background: #17212b;
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  transition: 0.2s ease;
}

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

.install-card {
  margin: 0 0 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 12px;
  color: #7c2d12;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .shell {
    padding: 12px 10px 28px;
  }

  .topbar {
    align-items: flex-start;
  }

  .nav-actions {
    flex-direction: column;
  }

  .panel {
    padding: 14px;
  }

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

  .bar {
    grid-template-columns: 1fr auto;
  }

  .track {
    grid-column: 1 / -1;
  }

  .actions .btn {
    flex: 1 1 150px;
  }
}
