/* Neptune 发卡后台 · 「纸墨」极简皮肤：平面纸面 + 1px 发丝线 + 数据等宽字体。 */
:root {
  color-scheme: light;
  --page: #fafafa;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-blue: #f3f3f1;
  --line: #e5e5e0;
  --line-strong: #c9c9c2;
  --text: #0a0a0a;
  --muted: #8a8a84;
  --blue: #0a0a0a;
  --blue-deep: #0a0a0a;
  --blue-pale: #f3f3f1;
  --pink: #faf1f3;
  --pink-deep: #db3356;
  --green: #eef5f0;
  --green-deep: #2e6b46;
  --yellow: #f7f2df;
  --yellow-deep: #866d27;
  --shadow: 0 1px 2px rgba(10, 10, 10, 0.05);
  --shadow-soft: 0 1px 2px rgba(10, 10, 10, 0.04);
  --radius-lg: 4px;
  --radius-md: 3px;
  --radius-sm: 2px;
  --font: -apple-system, "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  font-family: var(--font);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
  background: var(--page);
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* iPhone：保留双指缩放，但禁止双击放大干扰操作。 */
html,
body {
  touch-action: manipulation;
}

/* 触屏输入框不足 16px 会在 iPhone 聚焦时自动放大。 */
@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
strong {
  font-weight: 700;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.35;
}

h3 {
  line-height: 1.4;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

::selection {
  color: var(--text);
  background: rgba(10, 10, 10, 0.08);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  min-height: 44px;
  padding: 9px 16px;
  color: var(--text);
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.cloud-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.cloud-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(250, 250, 250, 0.96) 0%, rgba(250, 250, 250, 0.78) 48%, rgba(250, 250, 250, 0.92) 100%);
}

.cloud-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  filter: grayscale(1);
}

.cloud-orb {
  position: absolute;
  z-index: 1;
  width: 320px;
  height: 320px;
  border-radius: 50%;
}

.cloud-orb-one {
  top: -170px;
  right: 7%;
  background: rgba(10, 10, 10, 0.02);
}

.cloud-orb-two {
  bottom: -220px;
  left: -80px;
  background: rgba(10, 10, 10, 0.015);
}

#main-content {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.eyebrow,
.section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* 通用控件：墨线框按钮，无彩色实心底。 */
.button,
.icon-button,
.day-option {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  color: var(--text);
  border-color: var(--text);
  background: transparent;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.button:hover:not(:disabled),
.day-option:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: rgba(10, 10, 10, 0.04);
}

.button:active:not(:disabled),
.day-option:active:not(:disabled),
.icon-button:active:not(:disabled) {
  background: rgba(10, 10, 10, 0.08);
}

.button.primary {
  color: var(--surface-solid);
  border-color: var(--text);
  background: var(--text);
}

.button.primary:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text);
  background: transparent;
}

.button.secondary {
  color: var(--text);
  border-color: var(--line-strong);
  background: transparent;
}

.button.secondary:hover:not(:disabled) {
  border-color: var(--text);
  background: rgba(10, 10, 10, 0.04);
}

.button.danger {
  color: var(--pink-deep);
  border-color: var(--pink-deep);
  background: transparent;
}

.button.danger:hover:not(:disabled) {
  background: var(--pink);
}

.button.wide {
  width: 100%;
}

.button:disabled,
.icon-button:disabled,
.day-option:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.button[aria-busy="true"]::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-solid);
  font-weight: 500;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

.field input::placeholder {
  color: var(--muted);
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 70px;
}

.password-control .icon-button {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 60px;
  min-height: 44px;
  padding: 6px 10px;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 12px;
}

.password-control .icon-button:hover:not(:disabled) {
  color: var(--text);
}

.form-message {
  min-height: 0;
  margin: 8px 0 0;
  color: var(--pink-deep);
  font-size: 13px;
  line-height: 1.5;
}

.form-message:empty {
  display: none;
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* 登录 */
.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 36px 24px;
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.96fr);
  width: min(980px, 100%);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.login-art {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 560px;
  flex-direction: column;
  padding: 30px 36px 24px;
  overflow: hidden;
  background: var(--surface-blue);
}

.login-art::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: 80px;
  width: 220px;
  height: 220px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.brand-lockup,
.mobile-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup {
  position: relative;
  z-index: 2;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.15;
}

.brand-lockup small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.brand-lockup img,
.sidebar-brand img,
.mobile-brand img {
  flex: 0 0 auto;
  object-fit: contain;
}

.login-art-copy {
  position: relative;
  z-index: 2;
  margin-top: 60px;
}

.login-art-copy h2 {
  margin-bottom: 16px;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.login-art-copy p {
  max-width: 330px;
  color: var(--muted);
}

.login-mascot {
  position: absolute;
  right: 26px;
  bottom: 48px;
  z-index: 1;
  width: min(265px, 58%);
  max-height: 260px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.9;
}

.art-note {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  margin-top: auto;
  padding: 7px 12px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  font-size: 11px;
}

.login-form-wrap {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 54px 46px;
}

.login-form-wrap h1 {
  font-size: 32px;
}

.login-form-wrap > .muted {
  margin-bottom: 30px;
}

.login-form-wrap form {
  display: grid;
  gap: 16px;
}

.login-form-wrap .form-message {
  margin: -4px 0 0;
}

.security-note {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.security-note span {
  margin-right: 5px;
  color: var(--green-deep);
}

.mobile-brand {
  display: none;
}

/* 后台布局 */
.admin-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 24px;
  width: min(1540px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 20px;
}

.sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  min-width: 0;
  height: calc(100vh - 40px);
  height: calc(100svh - 40px);
  flex-direction: column;
  padding: 24px 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.sidebar-brand {
  min-height: 64px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.sidebar-brand strong {
  font-size: 24px;
  line-height: 1.15;
}

.sidebar-brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav-link {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 650;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.nav-link > span {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  font-size: 19px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-blue);
}

.sidebar-bottom {
  margin-top: auto;
}

.sidebar-bottom p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.workspace {
  min-width: 0;
  padding: 8px 4px 20px;
}

.workspace-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 6px 26px;
}

.workspace-header h1 {
  margin-bottom: 5px;
}

.workspace-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

/* 徽标：白底 + 1px 线 + 语义色文字，无彩色实心底。 */
.session-chip,
.soft-badge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  font-size: 12px;
  white-space: nowrap;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-deep);
  box-shadow: 0 0 0 3px var(--green);
}

.section-block,
.panel {
  scroll-margin-top: 24px;
}

.section-heading,
.panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin: 0 4px 14px;
}

.section-kicker {
  margin-bottom: 3px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* 统计卡：平面白底 + 1px 发丝线，hover 只改边框色。 */
.stat-card {
  display: flex;
  min-width: 0;
  min-height: 120px;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  transition: border-color 150ms ease;
}

.stat-card:hover {
  border-color: var(--text);
}

.stat-card > div {
  min-width: 0;
}

.stat-card span:not(.stat-icon) {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.stat-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-blue);
  font-size: 21px;
}

.stat-total {
  background: var(--surface-solid);
}

.stat-total .stat-icon {
  color: var(--text);
  background: var(--surface-blue);
}

.stat-active {
  background: var(--surface-solid);
}

.stat-active .stat-icon {
  color: var(--green-deep);
  background: var(--green);
}

.stat-unused {
  background: var(--surface-solid);
}

.stat-unused .stat-icon {
  color: var(--yellow-deep);
  background: var(--yellow);
}

.stat-revoked {
  background: var(--surface-solid);
}

.stat-revoked .stat-icon {
  color: var(--pink-deep);
  background: var(--pink);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.soft-badge {
  color: var(--text);
  background: var(--surface-solid);
}

.days-fieldset {
  min-width: 0;
  margin: 24px 0 18px;
  padding: 0;
  border: 0;
}

.days-fieldset legend {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.day-options {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.day-option {
  min-width: 0;
  padding: 8px 6px;
  color: var(--muted);
  border-color: var(--line-strong);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.day-option.selected {
  color: var(--surface-solid);
  border-color: var(--text);
  background: var(--text);
}

.generate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.custom-days {
  max-width: 260px;
}

.input-with-unit {
  position: relative;
  display: block;
}

.input-with-unit input {
  padding-right: 42px;
}

.input-with-unit > span {
  position: absolute;
  top: 50%;
  right: 15px;
  color: var(--muted);
  font-weight: 500;
  transform: translateY(-50%);
  pointer-events: none;
}

.flow-panel {
  background: var(--surface);
}

.flow-list {
  display: grid;
  gap: 18px;
  margin: 23px 0 0;
  padding: 0;
  list-style: none;
}

.flow-list li {
  position: relative;
  display: flex;
  min-width: 0;
  gap: 12px;
}

.flow-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 34px;
  bottom: -17px;
  left: 15px;
  width: 1px;
  background: var(--line-strong);
}

.flow-list li > span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-solid);
  font-size: 12px;
  font-weight: 800;
}

.flow-list strong {
  display: block;
  font-size: 14px;
}

.flow-list p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* 卡密列表：发丝线行卡 + 状态徽标。 */
.cards-panel {
  margin-top: 16px;
}

.cards-heading {
  align-items: flex-start;
}

.cards-heading p {
  margin: 6px 0 0;
}

.cards-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.license-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  transition: border-color 150ms ease, background-color 150ms ease;
}

.license-card:hover {
  border-color: var(--text);
  background: #f6f6f3;
}

.license-card-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

/* 脱敏卡密标识：等宽字体突出显示。 */
.license-hint {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-badge {
  display: inline-flex;
  min-height: 30px;
  flex: 0 0 auto;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  font-size: 11px;
  font-weight: 800;
}

.status-active {
  color: var(--green-deep);
  border-color: var(--green-deep);
}

.status-unused {
  color: var(--yellow-deep);
  border-color: var(--yellow-deep);
}

.status-revoked {
  color: var(--pink-deep);
  border-color: var(--pink-deep);
}

.status-expired {
  color: var(--muted);
  border-color: var(--line-strong);
}

.license-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 0;
}

.license-meta > div {
  min-width: 0;
}

.license-meta dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
}

.license-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.license-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.license-actions .button {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 12px;
}

.loading-state,
.empty-state {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
}

.loading-dot {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.empty-state img {
  width: 116px;
  height: 100px;
  margin: 0 auto 8px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.8;
}

.empty-state h3 {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 17px;
}

.empty-state p {
  margin-bottom: 18px;
  font-size: 13px;
}

/* 安全设置 */
.password-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 42px;
  margin-top: 16px;
}

.password-intro p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.password-form {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.password-form .field-help,
.password-form .form-message {
  margin-top: -5px;
}

.password-form .button {
  justify-self: start;
}

.workspace-footer {
  padding: 28px 10px 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* 对话框：白底平面 + 1px 墨线框 + 顶部 2px 墨条。 */
.dialog {
  width: min(520px, calc(100% - 32px));
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 30px;
  overflow: auto;
  color: var(--text);
  border: 1px solid var(--text);
  border-top: 2px solid var(--text);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
}

.dialog::backdrop {
  background: rgba(10, 10, 10, 0.35);
}

.dialog h2 {
  margin-bottom: 10px;
  font-size: 25px;
}

.dialog > p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-decoration,
.confirm-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  font-size: 26px;
  font-weight: 800;
}

.dialog-decoration {
  color: var(--green-deep);
}

.confirm-symbol {
  color: var(--pink-deep);
}

/* 生成的完整卡密：等宽大号、纸底墨字、虚线框强调。 */
.generated-card {
  display: block;
  width: 100%;
  min-height: 64px;
  padding: 18px 14px;
  overflow-wrap: anywhere;
  color: var(--text);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-blue);
  font-family: var(--mono);
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-align: center;
  user-select: all;
}

.dialog .form-message {
  margin: 10px 0 0;
  text-align: center;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.card-dialog .dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* 页面提示：白底 1px 线框小条，底部对齐（含 safe-area）。 */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  display: grid;
  width: min(390px, calc(100% - 40px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 0;
  padding: 13px 16px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  font-size: 13px;
  overflow-wrap: anywhere;
  animation: toast-in 180ms ease-out;
}

.toast.success {
  color: var(--green-deep);
  border-color: var(--green-deep);
}

.toast.error {
  color: var(--pink-deep);
  border-color: var(--pink-deep);
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 2000;
  margin: 0;
  padding: 16px;
  color: var(--pink-deep);
  border: 1px solid var(--pink-deep);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  text-align: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 中等屏幕 */
@media (max-width: 1180px) {
  .admin-layout {
    grid-template-columns: 218px minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
  }

  .sidebar {
    top: 16px;
    height: calc(100vh - 32px);
    height: calc(100svh - 32px);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 100px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flow-list li:not(:last-child)::after {
    top: 15px;
    right: -10px;
    bottom: auto;
    left: auto;
    width: 20px;
    height: 1px;
  }

  .license-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 手机与窄平板：单栏工作区 */
@media (max-width: 900px) {
  html {
    scroll-padding-top: 16px;
  }

  .login-shell {
    padding: 22px 16px;
  }

  .login-card {
    grid-template-columns: minmax(0, 1fr);
    width: min(520px, 100%);
  }

  .login-art {
    display: none;
  }

  .login-form-wrap {
    min-height: 500px;
    padding: 42px 34px;
  }

  .mobile-brand {
    display: flex;
    margin-bottom: 46px;
    font-size: 17px;
    font-weight: 800;
  }

  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 12px;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    height: auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-lg);
  }

  .sidebar-brand {
    min-height: 52px;
    padding: 0;
    border: 0;
  }

  .sidebar-brand img {
    width: 42px;
    height: 42px;
  }

  .sidebar-brand strong {
    font-size: 20px;
  }

  .sidebar-brand small,
  .sidebar-bottom p {
    display: none;
  }

  .side-nav {
    display: flex;
    min-width: 0;
    justify-content: center;
    gap: 5px;
    margin: 0;
  }

  .nav-link {
    min-height: 44px;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .nav-link > span {
    display: none;
  }

  .sidebar-bottom {
    margin: 0;
  }

  .sidebar-bottom .button {
    width: auto;
    padding: 8px 12px;
    font-size: 12px;
  }

  .workspace {
    padding: 0;
  }

  .workspace-header {
    padding: 16px 4px 22px;
  }

  .password-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .admin-layout {
    padding: 8px;
  }

  .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .side-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .sidebar-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .sidebar-bottom {
    grid-column: 2;
    grid-row: 1;
  }

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 18px 6px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    min-height: 102px;
    gap: 10px;
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .stat-card strong {
    font-size: 24px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 18px;
  }

  .panel {
    padding: 18px;
    border-radius: var(--radius-lg);
  }

  .section-heading,
  .panel-heading {
    align-items: flex-start;
  }

  .generator-panel .panel-heading {
    flex-direction: column;
    gap: 10px;
  }

  .day-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .generate-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .custom-days {
    max-width: none;
  }

  .generate-row .button {
    width: 100%;
  }

  .flow-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-list li:not(:last-child)::after {
    top: 34px;
    right: auto;
    bottom: -17px;
    left: 15px;
    width: 1px;
    height: auto;
  }

  .cards-heading {
    flex-direction: column;
  }

  .cards-heading .button {
    width: 100%;
  }

  .license-card {
    padding: 15px;
  }

  .license-card-header {
    align-items: flex-start;
  }

  .license-hint {
    font-size: 13px;
  }

  .license-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .license-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .license-actions .button:only-child {
    grid-column: 1 / -1;
  }

  .password-form .button {
    width: 100%;
    justify-self: stretch;
  }

  .dialog {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  .card-dialog .dialog-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog-actions .button {
    width: 100%;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 24px);
  }
}

@media (max-width: 380px) {
  .login-form-wrap {
    min-height: 480px;
    padding: 32px 22px;
  }

  .mobile-brand {
    margin-bottom: 36px;
  }

  .stat-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .session-chip {
    white-space: normal;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions .button,
  .session-chip {
    width: 100%;
    justify-content: center;
  }

  .license-meta {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .cloud-background video {
    display: none;
  }
}

/* ---- 卡密管理：完整卡密 / 折叠 / 搜索 ---- */
.cards-toolbar { margin: 10px 0 14px; }
.cards-search { width: 100%; padding: 10px 12px; font-size: 14px; color: #141413; background: #fff; border: 1px solid #141413; border-radius: 0; }
.license-card.collapsed .license-meta,
.license-card.collapsed .license-actions,
.license-card.collapsed .license-full { display: none; }
.license-card-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.license-toggle { margin-left: auto; }
.license-full { margin: 10px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.license-full .license-key { font-family: "Menlo", "Consolas", monospace; font-size: 14px; word-break: break-all; background: #f5f5f5; border: 1px solid #8b8b88; padding: 8px 10px; }
