/* ============================================================
   AUTHKEY · 用户端
   ============================================================ */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background:
    radial-gradient(900px 460px at 50% -12%, #e3edfd 0%, rgba(227,237,253,0) 62%),
    var(--paper);
}

.wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 22px;
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* ---------- 顶栏 ---------- */
.site-head {
  padding: 24px 0 0;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 3px 10px -2px rgba(22,104,220,.5);
}
.brand-mark .icon { width: 18px; height: 18px; stroke-width: 1.9; }
.brand-name {
  display: block;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .06em;
  line-height: 1.2;
  color: var(--ink);
}
.brand-sub {
  display: block;
  font-size: 11px;
  color: var(--faint);
  margin-top: 1px;
}

.head-note {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.head-note .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(7,148,85,.14);
}

/* ---------- 主区 ---------- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 44px 0 52px;
}
.stage-inner { width: 100%; }

.hero {
  text-align: center;
  margin-bottom: 30px;
}
.hero .eyebrow { margin-bottom: 12px; }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4.2vw, 34px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -.02em;
  color: var(--ink);
}
.hero p {
  margin: 0 auto;
  max-width: 440px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 主卡片 ---------- */
.sheet {
  position: relative;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(16,24,40,.03), 0 20px 48px -24px rgba(16,24,40,.22);
}
.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 55%, #7cc0ff);
}

.sheet-body { padding: 28px 30px 24px; }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.sheet-head-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.sheet-title {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
}
.sheet-desc {
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 1px;
}

/* ---------- 卡密输入 ---------- */
.code-field {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.code-field:hover { border-color: #b8c4d6; }
.code-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22,104,220,.13);
}
.code-field .icon-lead {
  display: grid;
  place-items: center;
  width: 46px;
  align-self: stretch;
  color: var(--faint);
  border-right: 1px solid var(--line);
  transition: color .15s;
}
.code-field:focus-within .icon-lead { color: var(--accent); }

.code-input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 15px 14px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
/* 设备码模式：不要强制大写间距，长串更易读 */
.code-input.is-device {
  text-transform: none;
  letter-spacing: .03em;
  font-size: 14px;
  font-weight: 500;
}
.code-input.is-device::placeholder {
  letter-spacing: .02em;
  font-size: 13px;
}

.code-input::placeholder {
  color: #b9c2d0;
  letter-spacing: .1em;
  font-size: 14.5px;
  font-weight: 500;
}

.code-clear {
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: .15s;
}
.code-field.has-value .code-clear { display: grid; }
.code-clear:hover { color: var(--danger); background: var(--danger-soft); }

#activateBtn { padding: 12px 18px; font-size: 14.5px; border-radius: 10px; }

.form-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.form-hint .icon { margin-top: 2px; color: var(--faint); }

/* ---------- 授权状态 ---------- */
#viewLicense { display: none; }
#viewLicense.show { display: block; }

.banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid #fecdca;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #912018;
  font-size: 13px;
  line-height: 1.6;
}
.banner.show { display: flex; }
.banner .icon { flex: none; margin-top: 1px; color: var(--danger); }

.lic-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.lic-plan {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.015em;
  color: var(--ink);
}
.lic-plan small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
}

/* 倒计时 */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.cd-cell {
  padding: 15px 6px 12px;
  text-align: center;
  min-width: 0;
  border-radius: 10px;
  background: linear-gradient(170deg, #f2f7ff, #e8f1fe);
  border: 1px solid #dce8fb;
}
.cd-num {
  font-family: var(--mono);
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.cd-label {
  margin-top: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #7b93b8;
}

.countdown.urgent .cd-cell { background: linear-gradient(170deg, #fffaf0, #fdf1dc); border-color: #fadfa6; }
.countdown.urgent .cd-num { color: var(--warn); }
.countdown.dead .cd-cell { background: var(--danger-soft); border-color: #fecdca; }
.countdown.dead .cd-num { color: var(--danger); }

/* 进度 */
.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  margin-bottom: 22px;
}
.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}

/* 信息格 */
.lic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.lic-item {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.lic-item .k {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}
.lic-item .k .icon { color: var(--faint); }
.lic-item .v {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}
.lic-item .v.hl { color: var(--accent); }

.lic-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.lic-actions .btn { border-radius: 9px; }

/* ---------- 卡片页脚 ---------- */
.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 13px 30px;
  border-top: 1px solid var(--line);
  background: #fafcfe;
  font-size: 12px;
  color: var(--muted);
}
.sheet-foot .dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
}
.sheet-foot .dot i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}
.sheet-foot .sep { color: var(--line-2); }

/* ---------- 站点页脚 ---------- */
.site-foot {
  padding: 0 0 26px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .site-head { padding-top: 16px; }
  .head-note { display: none; }
  .stage { padding: 26px 0 34px; }
  .hero { margin-bottom: 20px; }
  .hero h1 { font-size: clamp(23px, 6.6vw, 28px); }
  .hero p { font-size: 13px; }
  .sheet { border-radius: 14px; }
  .sheet-body { padding: 20px 16px 16px; }
  .sheet-foot { padding: 12px 16px; gap: 6px 12px; }
  .lic-top { flex-direction: column; gap: 8px; }
  .lic-plan { font-size: 21px; }
  .countdown { gap: 7px; }
  .cd-cell { padding: 12px 3px 10px; border-radius: 8px; }
  .cd-num { font-size: clamp(19px, 7vw, 26px); }
  .cd-label { font-size: 9px; margin-top: 6px; }
  .lic-grid { grid-template-columns: 1fr; gap: 8px; }
  .lic-item { padding: 11px 13px; }
  .code-field .icon-lead { width: 40px; }
  .code-input { font-size: 14.5px; letter-spacing: .09em; padding: 13px 10px; }
  .lic-actions { gap: 8px; }
  .lic-actions .btn { flex: 1 1 0; min-width: 0; padding: 9px 8px; font-size: 13px; }
}

/* ============================================================
   查询页：标签、结果、设备列表
   ============================================================ */

/* ---------- 查询方式切换 ---------- */
.q-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.q-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: .15s;
}
.q-tab .icon { color: var(--faint); transition: color .15s; }
.q-tab:hover { color: var(--ink); background: rgba(255,255,255,.72); }
.q-tab.on {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(16,24,40,.10);
}
.q-tab.on .icon { color: var(--accent); }

/* ---------- 返回 ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s;
}
.back-link .icon { transform: rotate(180deg); width: 14px; height: 14px; }
.back-link:hover { color: var(--accent); }

#viewResult { display: none; }

/* ---------- 应用标签 ---------- */
.lic-top-main { min-width: 0; }

.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #c7ddfb;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  max-width: 100%;
}
.app-chip .icon { width: 13px; height: 13px; stroke-width: 2; }
.app-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 激活区 ---------- */
.activate-area {
  display: none;
  margin-top: 4px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #c7ddfb;
  border-radius: 12px;
  background: #f7fbff;
}
.activate-area.show { display: block; }

.activate-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.activate-head .icon { flex: none; }

.activate-area .field { margin-bottom: 14px; }

.dev-row { display: flex; gap: 8px; }
.dev-row .input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  letter-spacing: .04em;
}
.dev-row .btn { flex: none; padding: 0 12px; }

.field-tip {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--faint);
}

/* ---------- 设备结果 ---------- */
#deviceResult { display: none; }

.device-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 15px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}
.dev-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}
.dev-info { min-width: 0; }
.dev-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
}
.dev-code {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}
.dev-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

.device-list { display: flex; flex-direction: column; gap: 9px; }

.dev-item {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.dev-item:hover {
  border-color: #c7ddfb;
  box-shadow: 0 4px 16px -8px rgba(22,104,220,.24);
}

.dev-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.dev-app {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-item-mid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.dev-plan {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.dev-remain {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.dev-remain.off { color: var(--muted); }

.dev-item-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .q-tabs { margin-bottom: 15px; }
  .q-tab { font-size: 13px; padding: 8px 8px; }
  .activate-area { padding: 13px; }
  .device-head { padding: 12px; gap: 9px; }
  .dev-ico { width: 32px; height: 32px; }
  .dev-code { font-size: 12px; }
  .dev-item { padding: 12px 13px; }
  .dev-item-mid { flex-direction: column; align-items: flex-start; gap: 3px; }
  .dev-item-bot { flex-direction: column; align-items: flex-start; gap: 3px; }
}
