:root {
  --bg: #0e0e12;
  --bg2: #16161c;
  --bg3: #1d1d25;
  --line: #2a2a34;
  --fg: #e8e8f0;
  --mute: #9a9aa8;
  --acc: #6f7dff;
  --ok: #35c46b;
  --warn: #e9b949;
  --err: #ff6b7f;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1b1b2a 0%, var(--bg) 55%) fixed;
  color: var(--fg);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acc); text-decoration: none; }
.wrap { max-width: 960px; margin: 0 auto; padding: 40px 20px 80px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #6f7dff, #a86bff);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff;
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .3px; }
.brand .tag { font-size: 11.5px; color: var(--mute); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.lead { color: var(--mute); margin: 6px 0 26px; font-size: 13.5px; }

.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 14.5px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.card h2::before { content: ""; width: 3px; height: 14px; background: var(--acc); border-radius: 2px; }

label { display: block; font-size: 12.5px; color: var(--mute); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: #0b0b10; color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  outline: none; transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc); }
input::placeholder { color: #5b5b68; font-family: inherit; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

button {
  appearance: none; border: 1px solid var(--line); background: var(--bg3); color: var(--fg);
  border-radius: 8px; padding: 10px 18px; font: inherit; font-size: 13.5px;
  cursor: pointer; transition: .12s;
}
button:hover:not(:disabled) { border-color: var(--acc); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: linear-gradient(135deg, #5f6dff, #8a5cff); border-color: transparent; font-weight: 600; }
button.danger { border-color: #5c2b31; background: #251417; color: #ffb3bd; }
button.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--bg3); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; }
.kpi b { display: block; font-size: 20px; font-weight: 650; line-height: 1.25; }
.kpi span { font-size: 11.5px; color: var(--mute); }

.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; border: 1px solid var(--line); color: var(--mute); }
.pill.ok { color: #8ff0b0; border-color: #1f5136; background: #10231a; }
.pill.warn { color: #f0d493; border-color: #5c4a1f; background: #241f12; }
.pill.err { color: #ffb3bd; border-color: #5c2b31; background: #251417; }
.pill.info { color: #b9c0ff; border-color: #34406b; background: #171c30; }

.result { border-radius: 9px; padding: 13px 15px; font-size: 13px; margin-top: 12px; display: none; }
.result.show { display: block; }
.result.ok { border: 1px solid #1f5136; background: #10231a; color: #b9f2cd; }
.result.err { border: 1px solid #5c2b31; background: #251417; color: #ffc3cb; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--mute); font-weight: 500; font-size: 11.5px; text-transform: none; white-space: nowrap; }
td.mono, .mono { font-family: ui-monospace, Consolas, monospace; }
tr:hover td { background: #1a1a22; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.scroll { overflow-x: auto; }

.toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; }
.toast {
  background: #22222c; border: 1px solid var(--line); border-left: 3px solid var(--acc);
  border-radius: 8px; padding: 9px 14px; font-size: 12.5px; color: var(--fg);
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: tin .16s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none;
  align-items: center; justify-content: center; z-index: 9000; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 22px; max-width: 560px; width: 100%; max-height: 80vh; overflow: auto; }
.modal h3 { margin: 0 0 14px; font-size: 15px; }

.keylist { display: grid; gap: 8px; }
.keyrow { display: flex; align-items: center; gap: 10px; background: #0b0b10; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.keyrow code { flex: 1; font-size: 13px; letter-spacing: .5px; user-select: all; }
.hint { font-size: 11.5px; color: var(--mute); margin-top: 8px; }
.foot { color: var(--mute); font-size: 11.5px; text-align: center; margin-top: 32px; }
.hide { display: none !important; }

@media (max-width: 640px) {
  .wrap { padding: 24px 14px 60px; }
  .row > * { min-width: 100%; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
