/* ==========================================================================
   渡舟 · 主样式
   温润米白纸感 / 皇家靛蓝 / 珊瑚橙点缀
   ========================================================================== */

:root {
  --bg: #f5f1e8;
  --bg-deep: #efe9dc;
  --card: #fffefb;
  --card-soft: #faf7f0;
  --card-tint: #f7f3e9;
  --ink: #232019;
  --ink-soft: #565044;
  --muted: #8a8274;
  --muted-light: #a39a8a;
  --line: #e6e1d6;
  --line-strong: #d8d1c2;
  --indigo: #283ecb;
  --indigo-deep: #1c2c9f;
  --indigo-soft: #e8eafb;
  --indigo-tint: #f1f2fd;
  --coral: #e76b42;
  --coral-deep: #c9542f;
  --coral-soft: #fbe9e2;
  --green: #2f8f68;
  --green-soft: #e4f3ec;
  --amber: #a97520;
  --amber-soft: #f8eed9;
  --red: #bd4530;
  --red-soft: #fbe7e2;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 30px 70px -46px rgba(65, 57, 39, 0.42), 0 10px 28px -22px rgba(65, 57, 39, 0.2);
  --shadow-float: 0 26px 60px -26px rgba(51, 46, 33, 0.38);
  --ease: cubic-bezier(0.22, 0.68, 0.26, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html.has-dialog {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1100px 680px at 12% -8%, rgba(255, 252, 244, 0.92), rgba(255, 252, 244, 0) 64%),
    radial-gradient(900px 580px at 92% 6%, rgba(226, 229, 250, 0.55), rgba(226, 229, 250, 0) 62%),
    radial-gradient(760px 620px at 84% 88%, rgba(247, 228, 218, 0.46), rgba(247, 228, 218, 0) 68%),
    var(--bg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body,
button,
input,
textarea,
select {
  font-family: var(--sans);
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--indigo);
  text-decoration: none;
}

::selection {
  background: rgba(40, 62, 203, 0.16);
  color: var(--indigo-deep);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

code,
pre {
  font-family: var(--mono);
}

.page-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    repeating-linear-gradient(115deg, rgba(93, 82, 58, 0.022) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(25deg, rgba(93, 82, 58, 0.016) 0 1px, transparent 1px 9px);
  mix-blend-mode: multiply;
}

/* --------------------------------------------------------------------------
   图标
   -------------------------------------------------------------------------- */

[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
}

.kicon {
  display: block;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--btn-border);
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease), border-color 0.18s var(--ease), opacity 0.18s var(--ease);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:focus-visible,
.link-btn:focus-visible,
.admin-entry:focus-visible,
.tab:focus-visible,
.modal-close:focus-visible,
.icon-btn:focus-visible,
.secret-toggle:focus-visible,
.code-copy:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  --btn-bg: linear-gradient(180deg, #3349d6 0%, #283ecb 55%, #2538bd 100%);
  --btn-fg: #fff;
  --btn-border: rgba(28, 44, 159, 0.4);
  box-shadow: 0 14px 26px -16px rgba(40, 62, 203, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 18px 32px -16px rgba(40, 62, 203, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-soft {
  --btn-bg: rgba(255, 254, 251, 0.86);
  --btn-fg: var(--ink-soft);
  --btn-border: var(--line-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.btn-soft:hover:not(:disabled) {
  --btn-bg: #fffefb;
  --btn-fg: var(--ink);
  border-color: #c9c1b1;
}

.btn-ghost {
  --btn-bg: rgba(255, 254, 251, 0.34);
  --btn-fg: var(--ink-soft);
  --btn-border: transparent;
}

.btn-ghost:hover:not(:disabled) {
  --btn-bg: rgba(255, 254, 251, 0.82);
  --btn-fg: var(--ink);
  border-color: var(--line);
}

.btn-text {
  --btn-fg: var(--muted);
  min-height: 36px;
  padding: 0 10px;
}

.btn-text:hover:not(:disabled) {
  --btn-fg: var(--ink);
  background: rgba(35, 32, 25, 0.04);
}

.btn-danger-ghost {
  --btn-fg: var(--red);
  --btn-border: rgba(189, 69, 48, 0.24);
  background: rgba(251, 231, 226, 0.52);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: rgba(189, 69, 48, 0.42);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  gap: 6px;
}

.btn[data-icon] {
  gap: 8px;
}

/* --------------------------------------------------------------------------
   顶部栏
   -------------------------------------------------------------------------- */

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1240px, calc(100% - 80px));
  margin: 0 auto;
  padding: 30px 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  box-shadow: 0 8px 18px -12px rgba(40, 62, 203, 0.55);
}

.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   页面骨架
   -------------------------------------------------------------------------- */

.shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(400px, 468px);
  align-items: center;
  gap: clamp(40px, 6.5vw, 94px);
  width: min(1180px, calc(100% - 80px));
  min-height: calc(100vh - 230px);
  margin: 0 auto;
  padding: 34px 0 54px;
}

/* --------------------------------------------------------------------------
   左栏介绍
   -------------------------------------------------------------------------- */

.hero {
  display: flex;
  align-items: center;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 620px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.34em;
}

.eyebrow-line {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, var(--coral), rgba(231, 107, 66, 0.1));
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 5.5vw, 78px);
  font-weight: 650;
  line-height: 1.16;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.hero-title-tail {
  display: block;
}

.hero-title .accent {
  position: relative;
  display: inline-block;
  color: var(--coral);
  font-style: italic;
  font-weight: 600;
}

.hero-title .accent::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 0;
  bottom: -5px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(231, 107, 66, 0.2), rgba(231, 107, 66, 0) 70%);
}

.hero-sub {
  max-width: 480px;
  margin: 27px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.9;
}

.assurances {
  display: grid;
  gap: 19px;
  margin: 42px 0 0;
  padding: 0;
  list-style: none;
  max-width: 480px;
}

.assurance {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.assurance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-top: 1px;
  border: 1px solid rgba(40, 62, 203, 0.12);
  border-radius: 12px;
  background: rgba(255, 254, 251, 0.72);
  color: var(--indigo);
  box-shadow: 0 8px 20px -18px rgba(40, 62, 203, 0.55);
}

.assurance strong {
  display: block;
  margin-bottom: 1px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.assurance p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

/* 插画 */
.hero-art {
  position: absolute;
  top: 48%;
  left: 54%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.orbit {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid rgba(40, 62, 203, 0.14);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-16deg);
}

.orbit-1 {
  width: 360px;
  height: 214px;
  animation: orbitDrift 20s ease-in-out infinite alternate;
}

.orbit-2 {
  width: 452px;
  height: 306px;
  border-color: rgba(231, 107, 66, 0.13);
  transform: translate(-50%, -50%) rotate(26deg);
  animation: orbitDriftAlt 26s ease-in-out infinite alternate;
}

.orbit-3 {
  width: 284px;
  height: 284px;
  border-style: dashed;
  border-color: rgba(40, 62, 203, 0.12);
  animation: orbitSpin 44s linear infinite;
}

.orbit-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(231, 107, 66, 0.1);
  transform: translate(-50%, -50%);
}

.dot-1 {
  left: -174px;
  top: -54px;
}

.dot-2 {
  left: 198px;
  top: 52px;
  width: 6px;
  height: 6px;
  background: var(--indigo);
  box-shadow: 0 0 0 5px rgba(40, 62, 203, 0.09);
}

.dot-3 {
  left: 24px;
  top: 150px;
  width: 5px;
  height: 5px;
  background: var(--muted);
  box-shadow: none;
}

.art-glow {
  position: absolute;
  left: 0;
  top: 0;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(225, 228, 250, 0.72), rgba(225, 228, 250, 0) 67%);
  transform: translate(-50%, -50%);
  animation: glowPulse 7s ease-in-out infinite;
}

.art-logo {
  position: absolute;
  left: 0;
  top: 0;
  width: 148px;
  height: 148px;
  transform: translate(-50%, -50%);
  animation: logoFloat 8s ease-in-out infinite;
}

.art-logo img {
  width: 100%;
  height: 100%;
  border-radius: 38px;
  box-shadow: 0 38px 70px -42px rgba(40, 62, 203, 0.6), 0 14px 30px -24px rgba(35, 32, 25, 0.35);
  animation: logoSpin 46s linear infinite;
}

.art-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--indigo);
  transform: translate(-50%, -50%);
  animation: sparkBlink 4.4s ease-in-out infinite;
}

.spark-1 {
  left: -212px;
  top: -128px;
}

.spark-2 {
  left: 228px;
  top: -104px;
  background: var(--coral);
  animation-delay: 1.4s;
}

.spark-3 {
  left: -102px;
  top: 188px;
  background: var(--coral);
  animation-delay: 2.6s;
  width: 4px;
  height: 4px;
}

@keyframes orbitDrift {
  from { transform: translate(-50%, -50%) rotate(-16deg); }
  to { transform: translate(-50%, -50%) rotate(-4deg); }
}

@keyframes orbitDriftAlt {
  from { transform: translate(-50%, -50%) rotate(26deg); }
  to { transform: translate(-50%, -50%) rotate(38deg); }
}

@keyframes orbitSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes logoFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-10px); }
}

@keyframes logoSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.62; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}

@keyframes sparkBlink {
  0%, 100% { opacity: 0.25; transform: translate(-50%, -50%) scale(0.7); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

/* --------------------------------------------------------------------------
   右侧授权卡片
   -------------------------------------------------------------------------- */

.auth-card {
  position: relative;
  z-index: 3;
  width: 100%;
  padding: 24px 26px 18px;
  border: 1px solid rgba(216, 209, 194, 0.78);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 254, 251, 0) 32%),
    var(--card);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(2px);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(230, 225, 214, 0.55);
  border-radius: 26px;
  pointer-events: none;
}

.auth-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
}

.steps {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 16px;
  top: 13px;
  height: 1px;
  background: var(--line);
}

.step {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 0.25s var(--ease);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.step.is-active {
  color: var(--ink);
}

.step.is-active .step-num {
  border-color: var(--indigo);
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 7px 14px -8px rgba(40, 62, 203, 0.7);
}

.step.is-done {
  color: var(--ink-soft);
}

.step.is-done .step-num {
  border-color: rgba(47, 143, 104, 0.35);
  background: var(--green-soft);
  color: var(--green);
}

.expiry {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(250, 247, 240, 0.8);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.expiry.is-live {
  border-color: rgba(40, 62, 203, 0.18);
  background: var(--indigo-tint);
  color: var(--indigo);
}

.expiry.is-success {
  border-color: rgba(47, 143, 104, 0.2);
  background: var(--green-soft);
  color: var(--green);
}

.expiry.is-urgent {
  border-color: rgba(189, 69, 48, 0.24);
  background: var(--red-soft);
  color: var(--red);
}

.expiry-icon {
  opacity: 0.8;
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 404px;
  padding: 30px 0 22px;
  text-align: center;
}

.stage-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  margin-bottom: 19px;
}

.stage-orbit {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(40, 62, 203, 0.18);
  border-radius: 50%;
  animation: orbitSpin 36s linear infinite;
}

.stage-icon-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(40, 62, 203, 0.15);
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 58%),
    linear-gradient(160deg, #eff1fd, #e3e7fb);
  color: var(--indigo);
  box-shadow: 0 22px 36px -26px rgba(40, 62, 203, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.stage[data-state="succeeded"] .stage-icon-wrap {
  border-color: rgba(47, 143, 104, 0.2);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 58%),
    linear-gradient(160deg, #ebf7f1, #dff1e8);
  color: var(--green);
  box-shadow: 0 22px 36px -26px rgba(47, 143, 104, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stage[data-state="failed"] .stage-icon-wrap {
  border-color: rgba(189, 69, 48, 0.18);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 58%),
    linear-gradient(160deg, #fcefea, #fae5de);
  color: var(--red);
  box-shadow: 0 22px 36px -26px rgba(189, 69, 48, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stage-spinner {
  display: none;
  position: absolute;
  inset: 5px;
  z-index: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--indigo);
  border-right-color: rgba(40, 62, 203, 0.22);
  animation: spin 0.9s linear infinite;
}

.stage[data-state="preparing"] .stage-spinner,
.stage[data-state="exchanging"] .stage-spinner {
  display: block;
}

.stage[data-state="preparing"] .stage-icon-wrap,
.stage[data-state="exchanging"] .stage-icon-wrap {
  animation: iconBreathe 2s ease-in-out infinite;
}

.stage-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.stage-desc {
  max-width: 350px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes iconBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

/* 表单字段 */
.field {
  width: 100%;
  text-align: left;
}

.cdk-field {
  max-width: 356px;
  margin: 24px auto 0;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.text-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(65, 57, 39, 0.04);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease);
}

.text-input::placeholder {
  color: var(--muted-light);
}

.text-input:hover {
  border-color: #c9c1b1;
}

.text-input:focus {
  border-color: var(--indigo);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(40, 62, 203, 0.1);
}

.text-input.has-icon {
  padding-left: 42px;
}

#cdk-code {
  min-height: 50px;
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.04em;
}

.field-hint {
  margin: 7px 1px 0;
  color: var(--muted-light);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  max-width: 356px;
  margin: 14px auto 0;
  padding: 10px 12px;
  border: 1px solid rgba(189, 69, 48, 0.2);
  border-radius: 11px;
  background: rgba(251, 231, 226, 0.65);
  color: var(--red);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}

.notice.is-info {
  border-color: rgba(40, 62, 203, 0.18);
  background: var(--indigo-tint);
  color: var(--indigo-deep);
}

.notice.is-success {
  border-color: rgba(47, 143, 104, 0.2);
  background: var(--green-soft);
  color: #246b4e;
}

.notice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 1px;
}

.result-field {
  max-width: 356px;
  margin: 22px auto 0;
  animation: fadeSlide 0.35s var(--ease);
}

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

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.result-area {
  min-height: 82px;
  margin-bottom: 9px;
  color: var(--indigo-deep);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  word-break: break-all;
  resize: vertical;
  background: var(--indigo-tint);
  border-color: rgba(40, 62, 203, 0.16);
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.stage-actions {
  display: grid;
  gap: 9px;
  width: 100%;
  max-width: 356px;
  margin: 22px auto 0;
}

.stage[data-state="succeeded"] .stage-actions {
  margin-top: 18px;
}

.stage-actions .btn {
  min-height: 46px;
}

.stage-actions .btn-text {
  min-height: 34px;
}

/* 底栏 */
.auth-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 14px 4px 2px;
  border-top: 1px solid rgba(230, 225, 214, 0.78);
}

.helper-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.01em;
}

.helper-state span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-light);
  box-shadow: 0 0 0 3px rgba(138, 130, 116, 0.1);
  transition: background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.dot.is-online {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 143, 104, 0.14);
  animation: dotPulse 2.8s ease-out infinite;
}

.dot.is-offline {
  background: #b8afa0;
  box-shadow: 0 0 0 3px rgba(138, 130, 116, 0.1);
}

.dot.is-busy {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(169, 117, 32, 0.14);
}

@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 143, 104, 0.24); }
  70% { box-shadow: 0 0 0 6px rgba(47, 143, 104, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 143, 104, 0); }
}

.link-btn {
  flex: 0 0 auto;
  padding: 2px;
  border: 0;
  background: none;
  color: var(--indigo);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.link-btn:hover {
  color: var(--indigo-deep);
  border-bottom-color: rgba(40, 62, 203, 0.35);
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */

.site-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 80px));
  margin: 0 auto;
  padding: 18px 0 26px;
  border-top: 1px solid rgba(216, 209, 194, 0.56);
  color: var(--muted-light);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.site-footer p {
  margin: 0;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.admin-entry {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted-light);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.14em;
  opacity: 0.46;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
}

.admin-entry:hover {
  opacity: 0.82;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   弹窗基础
   -------------------------------------------------------------------------- */

.modal {
  width: min(720px, calc(100vw - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.modal-wide,
.modal-admin {
  width: min(1120px, calc(100vw - 40px));
}

.modal-test {
  width: min(560px, calc(100vw - 40px));
}

.modal::backdrop {
  background: rgba(43, 38, 29, 0.42);
  backdrop-filter: blur(7px) saturate(0.9);
  animation: backdropIn 0.26s ease;
}

.modal-surface {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  border: 1px solid rgba(216, 209, 194, 0.9);
  border-radius: 28px;
  background:
    radial-gradient(900px 300px at 12% -10%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 62%),
    var(--card);
  box-shadow: 0 44px 100px -34px rgba(34, 30, 21, 0.46), 0 8px 26px -18px rgba(34, 30, 21, 0.22);
  overflow: hidden;
  animation: modalIn 0.34s var(--ease);
}

@keyframes backdropIn {
  from { background: rgba(43, 38, 29, 0); backdrop-filter: blur(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  flex: 0 0 auto;
  padding: 25px 30px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head > div:first-child {
  min-width: 0;
}

.modal-eyebrow {
  margin: 0 0 7px;
  color: var(--coral);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.modal-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.modal-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(250, 247, 240, 0.72);
  color: var(--muted);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}

.modal-close:hover {
  background: var(--coral-soft);
  border-color: rgba(231, 107, 66, 0.24);
  color: var(--coral-deep);
  transform: rotate(90deg);
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 30px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 247, 240, 0.44);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  flex: 0 0 auto;
  padding: 13px 15px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 0.18s var(--ease);
}

.tab::after {
  content: "";
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--indigo);
  transform: scaleX(0);
  transition: transform 0.22s var(--ease);
}

.tab:hover {
  color: var(--ink-soft);
}

.tab.is-active {
  color: var(--indigo);
}

.tab.is-active::after {
  transform: scaleX(1);
}

/* 通用表单块 */
.field-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
}

.field-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
}

.field-compact .text-input {
  min-height: 40px;
  font-size: 13px;
}

.field-compact.is-grow {
  flex: 1 1 180px;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-form .btn {
  min-height: 40px;
}

.select-input {
  min-height: 40px;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8274' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.select-input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(40, 62, 203, 0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.secret-wrap {
  position: relative;
  display: block;
}

.secret-wrap .text-input {
  padding-right: 62px;
}

.secret-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 9px;
  border: 0;
  border-radius: 7px;
  background: var(--card-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.secret-toggle:hover {
  color: var(--indigo);
  background: var(--indigo-tint);
}

/* --------------------------------------------------------------------------
   API 弹窗
   -------------------------------------------------------------------------- */

.api-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.api-origin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  border: 1px solid rgba(40, 62, 203, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(120deg, rgba(232, 234, 251, 0.68), rgba(250, 247, 240, 0.52));
}

.api-origin-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.api-origin-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.api-origin-main code {
  color: var(--indigo-deep);
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.api-body .tabs {
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.api-body .tab {
  padding-left: 12px;
  padding-right: 12px;
}

.api-body .tab::after {
  left: 12px;
  right: 12px;
}

.api-pane {
  display: none;
  animation: fadeSlide 0.3s var(--ease);
}

.api-pane.is-active {
  display: block;
}

.api-method {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.api-method code {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 9px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.method-post {
  background: var(--green-soft);
  color: var(--green);
}

.method-get {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.method-delete {
  background: var(--red-soft);
  color: var(--red);
}

.api-desc {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.api-desc code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--card-soft);
  color: var(--ink-soft);
  font-size: 11px;
}

.code-block {
  position: relative;
  border-radius: 15px;
  background:
    radial-gradient(700px 200px at 10% -30%, rgba(78, 95, 222, 0.24), rgba(78, 95, 222, 0) 60%),
    #201e2b;
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 20px 18px;
  overflow-x: auto;
  color: #e9e6f5;
  font-size: 11.5px;
  line-height: 1.75;
  tab-size: 2;
}

.code-block code {
  font-family: var(--mono);
  white-space: pre;
}

.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #dcd8ec;
  font-size: 10.5px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.code-copy:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.response-block {
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-soft);
  overflow: hidden;
}

.response-label {
  display: block;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.response-block pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   安装助手
   -------------------------------------------------------------------------- */

.helper-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.helper-steps {
  display: grid;
  gap: 12px;
}

.helper-step {
  display: flex;
  gap: 15px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(250, 247, 240, 0.8), rgba(255, 254, 251, 0.6));
}

.helper-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(40, 62, 203, 0.16);
  border-radius: 12px;
  background: var(--indigo-tint);
  color: var(--indigo);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.helper-step-body {
  min-width: 0;
}

.helper-step-body h3 {
  margin: 1px 0 4px;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.helper-step-body p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.helper-step-body p code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--card-soft);
  color: var(--ink-soft);
  font-size: 10.5px;
}

.helper-step-body .btn {
  margin-top: 10px;
}

.copy-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.76);
}

.copy-field code {
  color: var(--ink-soft);
  font-size: 11.5px;
  word-break: break-all;
}

.helper-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 17px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(250, 247, 240, 0.5);
}

/* --------------------------------------------------------------------------
   管理员：门禁
   -------------------------------------------------------------------------- */

.modal-admin {
  width: min(1128px, calc(100vw - 40px));
}

.admin-surface {
  transition: height 0.28s var(--ease);
}

.modal-admin.is-verified .admin-surface {
  height: min(892px, calc(100vh - 40px));
}

.admin-head {
  padding-bottom: 18px;
}

.admin-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 380px;
  padding: 40px 24px 54px;
}

.gate-card {
  width: min(382px, 100%);
  text-align: center;
}

.gate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  margin-bottom: 16px;
  border: 1px solid rgba(40, 62, 203, 0.14);
  border-radius: 20px;
  background: linear-gradient(160deg, #eff1fd, #e4e8fb);
  color: var(--indigo);
  box-shadow: 0 20px 34px -26px rgba(40, 62, 203, 0.6);
}

.gate-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 650;
}

.gate-card > p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.gate-form {
  display: grid;
  gap: 10px;
}

.gate-form .btn {
  min-height: 46px;
}

.admin-gate .notice {
  margin-top: 12px;
}

/* 管理员：主体 */
.admin-console {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.admin-tabs {
  flex: 0 0 auto;
  padding: 0 28px;
}

.admin-panes {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 28px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.admin-pane {
  display: none;
  animation: fadeSlide 0.3s var(--ease);
}

.admin-pane.is-active {
  display: block;
}

.admin-pane > * + * {
  margin-top: 16px;
}

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

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 15px 16px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.68), rgba(250, 247, 240, 0.76));
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -30px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(40, 62, 203, 0.05), rgba(40, 62, 203, 0) 66%);
}

.stat-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
}

.stat-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.stat-value-sm {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.9;
}

.stat-mark {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--muted-light);
  opacity: 0.72;
}

.stat-card.is-success .stat-value,
.stat-card.is-success .stat-mark {
  color: var(--green);
}

.stat-card.is-warning .stat-value,
.stat-card.is-warning .stat-mark {
  color: var(--amber);
}

.stat-card.is-muted .stat-value,
.stat-card.is-muted .stat-mark {
  color: var(--muted);
}

.stat-card.is-indigo .stat-value,
.stat-card.is-indigo .stat-mark {
  color: var(--indigo);
}

.admin-card {
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 254, 251, 0.78);
  box-shadow: 0 14px 30px -30px rgba(60, 54, 38, 0.28);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.card-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.card-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.card-desc code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--card-soft);
  color: var(--ink-soft);
  font-size: 10.5px;
}

.card-hint {
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.card-save-state {
  color: var(--green);
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.card-save-state.is-visible {
  opacity: 1;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid rgba(40, 62, 203, 0.14);
  border-radius: 999px;
  background: var(--indigo-tint);
  color: var(--indigo);
  font-size: 10px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.pill-soft {
  border-color: var(--line);
  background: var(--card-soft);
  color: var(--muted);
}

/* 导入折叠区 */
.import-details {
  padding: 0;
  overflow: hidden;
}

.import-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.import-details summary::-webkit-details-marker {
  display: none;
}

.summary-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.summary-chevron {
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}

.import-details[open] .summary-chevron {
  transform: rotate(180deg);
}

.import-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.details-body {
  padding: 15px 18px 18px;
  background: rgba(250, 247, 240, 0.38);
}

.import-textarea {
  min-height: 96px;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  resize: vertical;
}

.import-actions {
  margin-top: 12px;
}

/* 表格工具栏 */
.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
}

.table-toolbar .select-input {
  min-height: 36px;
  font-size: 12px;
}

.search-wrap {
  position: relative;
  flex: 1 1 200px;
  max-width: 280px;
  min-width: 160px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-light);
  pointer-events: none;
}

.search-input {
  min-height: 36px;
  padding-left: 34px;
  font-size: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: auto;
  max-height: 430px;
  scrollbar-gutter: stable;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: #f8f5ed;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 13px;
  border-bottom: 1px solid rgba(230, 225, 214, 0.68);
  color: var(--ink-soft);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(247, 243, 233, 0.62);
}

.data-table .align-right {
  text-align: right;
}

.cdk-code-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.cdk-code-cell .code-mark {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--indigo);
  opacity: 0.55;
}

.usage-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.usage-cell strong {
  color: var(--ink);
  font-weight: 650;
}

.note-cell {
  max-width: 230px;
}

.note-cell .cell-main {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-cell .cell-sub {
  display: block;
  color: var(--muted-light);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.badge.is-unused,
.badge.is-succeeded {
  background: var(--green-soft);
  color: var(--green);
}

.badge.is-locked,
.badge.is-running,
.badge.is-attention {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.is-used,
.badge.is-cancelled,
.badge.is-queued {
  background: #efebe3;
  color: var(--muted);
}

.badge.is-failed,
.badge.is-disabled {
  background: var(--red-soft);
  color: var(--red);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.icon-btn:hover {
  border-color: var(--line);
  background: var(--card-soft);
  color: var(--indigo);
}

.icon-btn.is-danger:hover {
  border-color: rgba(189, 69, 48, 0.2);
  background: var(--red-soft);
  color: var(--red);
}

.empty-row td,
.empty-state {
  padding: 26px 16px;
  color: var(--muted-light);
  font-size: 11.5px;
  text-align: center;
}

/* 校验源列表 */
.source-list {
  display: grid;
  gap: 8px;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(250, 247, 240, 0.5);
}

.source-index {
  flex: 0 0 auto;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.source-row .text-input {
  flex: 1 1 auto;
  min-height: 36px;
  font-size: 12px;
  font-family: var(--mono);
}

.source-row .btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

/* 设备 */
.device-stat-grid .stat-value {
  font-family: var(--sans);
  font-size: 24px;
}

.device-key-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 13px;
  padding: 13px 15px;
  border: 1px solid rgba(40, 62, 203, 0.16);
  border-radius: 13px;
  background: var(--indigo-tint);
  animation: fadeSlide 0.3s var(--ease);
}

.device-key-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.device-key-label {
  color: var(--indigo);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.device-key-main code {
  color: var(--indigo-deep);
  font-size: 12px;
  font-weight: 600;
  word-break: break-all;
}

.device-list {
  display: grid;
  gap: 8px;
}

.device-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(250, 247, 240, 0.44);
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.device-row:hover {
  border-color: var(--line-strong);
  background: rgba(250, 247, 240, 0.72);
}

.device-status {
  flex: 0 0 auto;
}

.device-main {
  min-width: 0;
  flex: 1 1 auto;
}

.device-name {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
}

.device-id {
  display: block;
  margin-top: 1px;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-builtin {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--indigo-tint);
  color: var(--indigo);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.device-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  flex: 0 0 auto;
}

.device-actions .btn {
  min-height: 29px;
  padding: 0 9px;
  font-size: 10.5px;
}

.builtin-note {
  flex: 0 0 auto;
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* 测试弹窗 */
.test-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.test-target {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-soft);
}

.test-target-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.test-target code {
  color: var(--ink-soft);
  font-size: 11.5px;
  word-break: break-all;
}

.test-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-soft);
  animation: fadeSlide 0.25s var(--ease);
}

.test-result.is-available {
  border-color: rgba(47, 143, 104, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

.test-result.is-unavailable {
  border-color: rgba(169, 117, 32, 0.24);
  background: var(--amber-soft);
  color: var(--amber);
}

.test-result.is-error {
  border-color: rgba(189, 69, 48, 0.22);
  background: var(--red-soft);
  color: var(--red);
}

.test-result.is-loading {
  border-color: rgba(40, 62, 203, 0.2);
  background: var(--indigo-tint);
  color: var(--indigo);
}

.test-result-icon {
  display: inline-flex;
  flex: 0 0 auto;
  margin-top: 1px;
}

.test-result-copy {
  min-width: 0;
}

.test-result-copy strong {
  display: block;
  font-size: 12px;
  font-weight: 650;
}

.test-result-copy p {
  margin: 3px 0 0;
  color: inherit;
  font-size: 11px;
  line-height: 1.6;
  opacity: 0.86;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .hero-art {
    display: none;
  }
}

@media (max-width: 1180px) {
  .hero-title {
    font-size: clamp(46px, 5vw, 68px);
  }
}

@media (max-width: 1020px) {
  .shell {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
    gap: 44px;
    width: min(100% - 56px, 1080px);
  }

  .hero-art {
    display: none;
  }
}

@media (max-width: 880px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    width: min(100% - 48px, 620px);
    min-height: 0;
    gap: 40px;
    padding-top: 20px;
  }

  .hero {
    padding-top: 18px;
  }

  .hero-copy {
    max-width: none;
  }

  .hero-title {
    font-size: clamp(44px, 10vw, 64px);
  }

  .hero-art {
    display: none;
  }

  .assurances {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    max-width: none;
    margin-top: 32px;
  }

  .assurance {
    flex-direction: column;
    gap: 9px;
  }

  .assurance p {
    font-size: 12px;
  }

  .auth-card {
    max-width: 540px;
    margin: 0 auto;
  }

  .site-footer,
  .topbar {
    width: calc(100% - 48px);
  }
}

@media (max-width: 680px) {
  .topbar {
    width: calc(100% - 32px);
    padding-top: 20px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    font-size: 20px;
  }

  .topbar-actions {
    gap: 2px;
  }

  .topbar-actions .btn {
    min-height: 38px;
    padding: 0 11px;
    font-size: 12.5px;
  }

  .shell {
    width: calc(100% - 32px);
    padding: 16px 0 38px;
    gap: 32px;
  }

  .eyebrow {
    margin-bottom: 16px;
  }

  .hero-title {
    font-size: clamp(40px, 12.2vw, 54px);
  }

  .hero-sub {
    margin-top: 20px;
    font-size: 14.5px;
    line-height: 1.8;
  }

  .assurances {
    grid-template-columns: 1fr;
    gap: 13px;
    margin-top: 26px;
  }

  .assurance {
    flex-direction: row;
  }

  .auth-card {
    padding: 20px 18px 16px;
    border-radius: 26px;
  }

  .auth-card::before {
    inset: 6px;
    border-radius: 21px;
  }

  .auth-head {
    gap: 10px;
  }

  .steps {
    gap: 3px;
  }

  .step {
    gap: 5px;
    padding-right: 5px;
    font-size: 10px;
  }

  .step-num {
    width: 23px;
    height: 23px;
    font-size: 10px;
  }

  .steps::before {
    top: 11.5px;
  }

  .expiry {
    padding: 4px 7px;
    font-size: 9.5px;
  }

  .stage {
    min-height: 380px;
    padding-top: 26px;
  }

  .stage-title {
    font-size: 24px;
  }

  .stage-desc {
    font-size: 12px;
  }

  .site-footer {
    width: calc(100% - 32px);
    padding-bottom: 20px;
  }

  .modal,
  .modal-wide,
  .modal-admin,
  .modal-test {
    width: calc(100vw - 20px);
  }

  .modal-surface {
    max-height: calc(100vh - 20px);
    border-radius: 22px;
  }

  .modal-head {
    padding: 20px 18px 16px;
  }

  .modal-title {
    font-size: 21px;
  }

  .modal-sub {
    font-size: 11px;
  }

  .modal-body {
    padding: 18px;
  }

  .tabs {
    padding: 0 16px;
  }

  .admin-tabs {
    padding: 0 14px;
  }

  .admin-panes {
    padding: 16px 14px 20px;
  }

  .modal-admin.is-verified .admin-surface {
    height: calc(100vh - 20px);
  }

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

  .stat-card {
    padding: 12px 13px;
  }

  .stat-value {
    font-size: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .api-origin-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .api-origin-card .btn {
    align-self: stretch;
  }

  .table-toolbar {
    align-items: stretch;
  }

  .search-wrap {
    max-width: none;
  }

  .toolbar-actions {
    width: 100%;
    margin-left: 0;
  }

  .toolbar-actions .btn {
    flex: 1 1 auto;
  }

  .source-row {
    flex-wrap: wrap;
  }

  .source-row .text-input {
    flex-basis: calc(100% - 40px);
  }

  .source-row .btn {
    flex: 1 1 auto;
  }

  .device-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  .device-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .device-key-box {
    flex-direction: column;
    align-items: flex-start;
  }

  .helper-step {
    padding: 14px;
    gap: 11px;
  }

  .helper-step-num {
    width: 32px;
    height: 32px;
  }

  .copy-field {
    flex-wrap: wrap;
  }

  .helper-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .helper-foot .btn {
    width: 100%;
  }

  .admin-gate {
    min-height: 320px;
    padding: 30px 12px 40px;
  }
}

@media (max-width: 360px) {
  .topbar {
    width: calc(100% - 24px);
    gap: 8px;
    padding-top: 16px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .brand-name {
    font-size: 18px;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 0;
  }

  .topbar-actions .btn {
    min-height: 36px;
    padding: 0 8px;
    gap: 5px;
    font-size: 11.5px;
  }
}

@media (max-width: 420px) {
  .steps {
    gap: 3px;
  }

  .step {
    gap: 3px;
    padding-right: 2px;
    font-size: 9px;
  }

  .step-num {
    width: 20px;
    height: 20px;
    font-size: 9.5px;
  }

  .step-label {
    font-size: 8.5px;
    letter-spacing: -0.02em;
  }

  .steps::before {
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .expiry {
    padding: 3px 6px;
    font-size: 8px;
    gap: 3px;
  }

  .expiry-icon {
    width: 11px;
    height: 11px;
  }

  .topbar-actions .btn span:last-child {
    font-size: 12px;
  }

  .auth-card {
    padding: 18px 14px 14px;
  }

  .stage-actions .btn {
    min-height: 44px;
  }
}

@media (max-width: 340px) {
  .step-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
