:root {
  --bg: #f3f6fb;
  --ink: #152033;
  --muted: #6a788c;
  --line: #e5edf6;
  --card: #fff;
  --blue: #1f5eff;
  --blue-2: #4b86ff;
  --navy: #10192c;
  --ok: #0c9a6a;
  --warn: #b86e00;
  --err: #d14343;
  --soft: #eaf0ff;
  --shadow: 0 18px 48px rgba(20, 40, 80, .08);
  --radius: 16px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }

.home, .miss { min-height: 100vh; }
.home {
  display: grid;
  grid-template-columns: minmax(320px, 560px) minmax(280px, 460px);
  gap: 48px;
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(31, 94, 255, .16), transparent 60%),
    linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .04em; }
.mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--blue), #163ea8);
  box-shadow: 0 8px 18px rgba(31, 94, 255, .28);
  position: relative;
}
.mark:before {
  content: ""; position: absolute; left: 10px; top: 8px; width: 14px; height: 17px;
  border: 2px solid #fff; border-radius: 3px;
}
.mark:after {
  content: ""; position: absolute; left: 13px; top: 13px; width: 8px; height: 2px; background: #fff;
  box-shadow: 0 4px 0 #fff;
}
.home h1 { font-size: 52px; line-height: 1.05; margin: 18px 0 12px; letter-spacing: -1px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 22px; max-width: 460px; }
.steps { display: grid; gap: 10px; margin: 0 0 26px; padding: 0; list-style: none; }
.steps li { display: flex; gap: 12px; align-items: center; color: #31445f; }
.num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--soft); color: var(--blue);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.go { display: flex; gap: 8px; }
.go input, .field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; outline: none;
}
.go input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: #b9cbff; box-shadow: 0 0 0 4px rgba(31,94,255,.12); }
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; background: var(--blue); color: #fff; font-weight: 650;
  white-space: nowrap;
}
.go .btn { min-width: 84px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.warn { background: #fff4f2; color: var(--err); }
.btn.small { padding: 7px 10px; border-radius: 9px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.preview {
  background: #fff; border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid #edf2f8;
}
.preview header, .topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #d5deea; display: block; }
.file { display: flex; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid #f2f5fa; }
.file b { font-weight: 600; }
.file span { color: var(--muted); font-size: 13px; }
.miss {
  display: grid; place-items: center; padding: 32px 16px;
  background: linear-gradient(180deg, #eef2f7, #f7f9fc 40%, #fff);
}
.miss .card, .panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #edf2f8;
}
.miss .card { width: min(460px, 100%); padding: 36px 32px; text-align: center; }
.miss h1 { margin: 8px 0; font-size: 28px; }
.miss p { color: var(--muted); }

.work { background: #f5f7fb; }
.topbar { background: #fff; position: sticky; top: 0; z-index: 5; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--soft); color: #24407a; border-radius: 999px; padding: 6px 10px; font-size: 13px; }
.chip.bad { background: #fff1f0; color: var(--err); }
.wrap { width: min(1080px, calc(100% - 32px)); margin: 22px auto 40px; display: grid; gap: 16px; }
.panel { padding: 18px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.field { display: grid; gap: 6px; }
.field span, .label { font-size: 13px; color: var(--muted); }
textarea { min-height: 92px; resize: vertical; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .04em; }
tr:hover td { background: #f8faff; }
.folder { color: #2450c8; cursor: pointer; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }
.pager { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 13px; }
.modal-back {
  position: fixed; inset: 0; background: rgba(16, 25, 44, .46); display: grid; place-items: center; padding: 18px; z-index: 30;
}
.modal { width: min(560px, 100%); background: #fff; border-radius: 18px; padding: 20px; box-shadow: 0 24px 70px rgba(8,16,40,.24); }
.modal h3 { margin: 0 0 8px; }
.modal p { color: #3d4d63; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.linkbox { width: 100%; min-height: 140px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.admin { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #d5def0; padding: 18px 12px; }
.side .brand { color: #fff; padding: 6px 8px 18px; }
.side button {
  width: 100%; text-align: left; background: transparent; color: #c9d4e8; border: 0; border-radius: 10px; padding: 11px 12px; margin-bottom: 4px;
}
.side button.on { background: rgba(31,94,255,.28); color: #fff; }
.main { padding: 22px 24px 40px; min-width: 0; overflow-x: auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: #fff; border: 1px solid #edf2f8; border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 28px; margin-top: 4px; letter-spacing: -0.5px; }
.stat span { color: var(--muted); font-size: 13px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.search { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; }
.note { color: var(--muted); font-size: 13px; }
.tag { border-radius: 999px; padding: 2px 8px; font-size: 12px; background: #eef2f7; }
.tag.used { background: #e7f8f1; color: var(--ok); }
.tag.unused { background: var(--soft); color: #24407a; }
.tag.disabled, .tag.failed, .tag.expired, .tag.exhausted { background: #fff1f0; color: var(--err); }
.tag.success, .tag.ready { background: #e7f8f1; color: var(--ok); }
.tag.invalid { background: #fff6e8; color: var(--warn); }
.cut { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock {
  min-height: 100vh; display: grid; place-items: center; background: var(--navy);
}
.lock .card { width: min(400px, calc(100% - 28px)); background: #fff; border-radius: 18px; padding: 24px; }

@media (max-width: 900px) {
  .home { grid-template-columns: 1fr; padding: 28px 16px; }
  .home h1 { font-size: 38px; }
  .admin { grid-template-columns: 1fr; }
  .side { display: flex; gap: 6px; overflow: auto; padding: 10px; align-items: center; }
  .side .brand { display: none; }
  .side button { width: auto; white-space: nowrap; }
  .stats, .search { grid-template-columns: 1fr 1fr; }
  .main { padding: 14px; }
}
