:root {
  --bg: #080b1c;
  --panel: #12162e;
  --panel-2: #1a1f3c;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef0ff;
  --muted: #9aa1c9;
  --accent: #6c7cff;
  --accent-soft: rgba(108, 124, 255, 0.16);
  --violet: #8b7bff;
  --success: #30d158;
  --warning: #ffd60a;
  --danger: #ff453a;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 620px;
  margin: 0 auto;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom));
}

.hero {
  border-radius: 22px;
  padding: 20px;
  background: linear-gradient(135deg, #0b0f2c 0%, #242a66 55%, #453a92 100%);
  box-shadow: 0 12px 32px rgba(108, 124, 255, 0.25);
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: linear-gradient(135deg, #6c7cff, #8b7bff);
}

.hero h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.hero .sub {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  margin-top: 3px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.14);
}

.pill.ok { color: var(--success); }
.pill.warn { color: var(--warning); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.card-head .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.row:first-of-type { border-top: 0; }

.row .tile {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: var(--accent-soft);
  flex: none;
}

.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 15px; }
.row .desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

.switch {
  position: relative;
  width: 46px;
  height: 28px;
  flex: none;
  border-radius: 999px;
  background: #2a2f52;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: linear-gradient(135deg, #6c7cff, #5b5ce0); color: #fff; }
.btn-danger { background: rgba(255, 69, 58, 0.12); color: var(--danger); border: 1px solid var(--danger); }
.btn-ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }

.btn-row { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }

.banner {
  display: flex;
  gap: 12px;
  margin: 0 16px 14px;
  padding: 13px;
  border-radius: 14px;
  background: rgba(255, 214, 10, 0.12);
  color: var(--text);
  font-size: 13px;
}
.banner.danger { background: rgba(255, 69, 58, 0.12); }

label.field { display: block; padding: 12px 16px; border-top: 1px solid var(--line); }
label.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
}

textarea {
  min-height: 280px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.back {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.topbar h2 { flex: 1; margin: 0; font-size: 18px; }

.log-box {
  margin: 0 16px 14px;
  height: 220px;
  overflow: auto;
  background: #05060f;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: #9ef0a1;
  white-space: pre-wrap;
  word-break: break-all;
}

.muted { color: var(--muted); }
.center { text-align: center; padding: 30px 16px; }
.empty { color: var(--muted); font-size: 14px; }

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 8px;
  flex: none;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.08); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: #171b35;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 50;
}

.login-box {
  max-width: 360px;
  margin: 80px auto 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.login-box h1 { font-size: 20px; margin: 0 0 18px; text-align: center; }
.login-box .field { padding: 0; border-top: 0; margin-bottom: 14px; }

@media (min-width: 640px) {
  .app { padding-top: 28px; }
}
