/* Neptune 发卡后台：独立、轻量的云朵工作区。 */
:root {
  color-scheme: light;
  --page: #edf8fc;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-blue: #eef8fc;
  --line: #d4e7ef;
  --line-strong: #b9d9e6;
  --text: #23495e;
  --muted: #647f8f;
  --blue: #83c9e5;
  --blue-deep: #347d9f;
  --blue-pale: #dff2fa;
  --pink: #fff0f3;
  --pink-deep: #a95869;
  --green: #e6f6f0;
  --green-deep: #337861;
  --yellow: #fff7df;
  --yellow-deep: #866d27;
  --shadow: 0 18px 50px rgba(67, 117, 139, 0.12);
  --shadow-soft: 0 8px 24px rgba(67, 117, 139, 0.09);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 13px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Hiragino Sans GB", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  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:
    radial-gradient(circle at 84% 8%, rgba(255, 255, 255, 0.92), transparent 28%),
    radial-gradient(circle at 4% 94%, rgba(255, 225, 233, 0.28), transparent 30%),
    var(--page);
  font-size: 15px;
  line-height: 1.6;
  -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.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.35;
}

h3 {
  line-height: 1.4;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid #347d9f;
  outline-offset: 3px;
}

::selection {
  color: #163e55;
  background: #c5ebf8;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
  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(120deg, rgba(237, 248, 252, 0.83), rgba(237, 248, 252, 0.57) 50%, rgba(237, 248, 252, 0.88));
}

.cloud-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.62;
}

.cloud-orb {
  position: absolute;
  z-index: 1;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(2px);
}

.cloud-orb-one {
  top: -170px;
  right: 7%;
  background: rgba(255, 255, 255, 0.5);
}

.cloud-orb-two {
  bottom: -220px;
  left: -80px;
  background: rgba(255, 220, 229, 0.2);
}

#main-content {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.eyebrow,
.section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--blue-deep);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.18em;
}

/* 通用控件 */
.button,
.icon-button,
.day-option {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.button:hover:not(:disabled),
.day-option:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled),
.day-option:active:not(:disabled),
.icon-button:active:not(:disabled) {
  transform: translateY(0);
}

.button.primary {
  color: #173f55;
  border-color: #78bad5;
  background: #a9def0;
  box-shadow: 0 4px 0 #d0ebf5;
}

.button.primary:hover:not(:disabled) {
  background: #bce8f6;
}

.button.secondary {
  color: #315e74;
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.78);
}

.button.secondary:hover:not(:disabled) {
  background: #f3fbfe;
  border-color: #90c5da;
}

.button.danger {
  color: #8b4050;
  border-color: #edc5cd;
  background: #fff0f3;
}

.button.danger:hover:not(:disabled) {
  background: #ffe4e9;
}

.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: #365c70;
  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: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus {
  border-color: #66accb;
  box-shadow: 0 0 0 3px rgba(102, 172, 203, 0.2);
}

.field input::placeholder {
  color: #91a7b3;
}

.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(--blue-deep);
  border: 0;
  background: transparent;
  font-size: 12px;
}

.form-message {
  min-height: 0;
  margin: 8px 0 0;
  color: #a14659;
  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 rgba(190, 218, 229, 0.82);
  border-radius: 32px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(58, 110, 133, 0.16);
  backdrop-filter: blur(18px);
}

.login-art {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 560px;
  flex-direction: column;
  padding: 30px 36px 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 16%, rgba(255, 255, 255, 0.85), transparent 28%),
    linear-gradient(150deg, #e5f5fb, #d4edf7);
}

.login-art::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: 80px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  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: #6c91a4;
  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.35;
  letter-spacing: -0.04em;
}

.login-art-copy p {
  max-width: 330px;
  color: #587b8e;
}

.login-mascot {
  position: absolute;
  right: 26px;
  bottom: 48px;
  z-index: 1;
  width: min(265px, 58%);
  max-height: 260px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(65, 116, 137, 0.12));
}

.art-note {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  margin-top: auto;
  padding: 7px 12px;
  color: #547a8e;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.45);
  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: #63aa91;
}

.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 rgba(190, 218, 229, 0.86);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.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: #577588;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 650;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms 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: #285e79;
  border-color: #d0e7f0;
  background: #e9f6fb;
}

.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;
}

.session-chip,
.soft-badge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: #4b7489;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  white-space: nowrap;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #58ad8d;
  box-shadow: 0 0 0 4px rgba(88, 173, 141, 0.13);
}

.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;
}

.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);
  box-shadow: var(--shadow-soft);
}

.stat-card > div {
  min-width: 0;
}

.stat-card span:not(.stat-icon) {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 1px;
  font-size: 32px;
  line-height: 1.25;
}

.stat-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  font-size: 21px;
}

.stat-total {
  background: rgba(255, 255, 255, 0.9);
}

.stat-total .stat-icon {
  color: #49758c;
  background: #edf5f8;
}

.stat-active {
  background: rgba(231, 247, 241, 0.92);
}

.stat-active .stat-icon {
  color: var(--green-deep);
  background: #d6efe5;
}

.stat-unused {
  background: rgba(255, 248, 225, 0.93);
}

.stat-unused .stat-icon {
  color: var(--yellow-deep);
  background: #f9ecc1;
}

.stat-revoked {
  background: rgba(255, 240, 243, 0.93);
}

.stat-revoked .stat-icon {
  color: var(--pink-deep);
  background: #f9dfe5;
}

.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 rgba(190, 218, 229, 0.85);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.soft-badge {
  color: var(--blue-deep);
  background: var(--blue-pale);
}

.days-fieldset {
  min-width: 0;
  margin: 24px 0 18px;
  padding: 0;
  border: 0;
}

.days-fieldset legend {
  margin-bottom: 9px;
  color: #365c70;
  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: #537487;
  border-color: var(--line);
  background: #f8fcfe;
  font-size: 13px;
  font-weight: 700;
}

.day-option.selected {
  color: #285d77;
  border-color: #89c5dc;
  background: #dff2fa;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.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: linear-gradient(145deg, rgba(237, 248, 252, 0.95), rgba(255, 255, 255, 0.92));
}

.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: #c9e2ec;
}

.flow-list li > span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: #36718e;
  border: 1px solid #c0dfeb;
  border-radius: 50%;
  background: #f7fcfe;
  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: 18px;
  background: rgba(250, 253, 254, 0.88);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.license-card:hover {
  border-color: #bddde9;
  box-shadow: 0 7px 20px rgba(71, 120, 140, 0.07);
}

.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: #28566d;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.status-badge {
  display: inline-flex;
  min-height: 30px;
  flex: 0 0 auto;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
}

.status-active {
  color: var(--green-deep);
  background: var(--green);
}

.status-unused {
  color: var(--yellow-deep);
  background: var(--yellow);
}

.status-revoked {
  color: var(--pink-deep);
  background: var(--pink);
}

.status-expired {
  color: #687681;
  background: #edf1f3;
}

.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: #355a6e;
  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 dashed #dceaf0;
}

.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 #b6d9e7;
  border-top-color: #4e98b8;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.empty-state img {
  width: 116px;
  height: 100px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.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: #78909d;
  font-size: 11px;
  text-align: center;
}

/* 对话框 */
.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 #c5dfe9;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(38, 79, 98, 0.25);
}

.dialog::backdrop {
  background: rgba(31, 65, 82, 0.36);
  backdrop-filter: blur(5px);
}

.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-radius: 17px;
  font-size: 26px;
  font-weight: 800;
}

.dialog-decoration {
  color: var(--green-deep);
  background: var(--green);
}

.confirm-symbol {
  color: var(--pink-deep);
  background: var(--pink);
}

.generated-card {
  display: block;
  width: 100%;
  min-height: 64px;
  padding: 18px 14px;
  overflow-wrap: anywhere;
  color: #215b78;
  border: 1px dashed #8fc4d9;
  border-radius: 15px;
  background: #edf8fc;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 800;
  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;
}

/* 页面提示 */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  display: grid;
  width: min(390px, calc(100% - 40px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 0;
  padding: 13px 16px;
  color: #315b70;
  border: 1px solid #c5dfe9;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  font-size: 13px;
  overflow-wrap: anywhere;
  animation: toast-in 180ms ease-out;
}

.toast.success {
  color: var(--green-deep);
  border-color: #bfdfd2;
}

.toast.error {
  color: #994557;
  border-color: #edc6ce;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 2000;
  margin: 0;
  padding: 16px;
  color: #8b4050;
  border: 1px solid #edc5cd;
  border-radius: 14px;
  background: #fff0f3;
  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: 22px;
  }

  .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: 17px;
  }

  .stat-card strong {
    font-size: 27px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 18px;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .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: 22px;
  }

  .card-dialog .dialog-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog-actions .button {
    width: 100%;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    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;
  }
}


/* ================= HuQin 狐沁 · 草莓授权手帐 ================= */
:root {
  --page: oklch(0.972 0.012 82);
  --surface: color-mix(in oklch, oklch(0.987 0.009 82) 78%, transparent);
  --surface-solid: oklch(0.987 0.009 82);
  --surface-blue: oklch(0.91 0.045 15);
  --line: oklch(0.84 0.035 20);
  --line-strong: oklch(0.73 0.07 22);
  --text: oklch(0.36 0.038 18);
  --muted: oklch(0.47 0.045 20);
  --blue: oklch(0.638 0.206 31);
  --blue-deep: oklch(0.5 0.13 28);
  --blue-pale: oklch(0.91 0.045 15);
  --pink: oklch(0.91 0.045 15);
  --pink-deep: oklch(0.48 0.15 15);
  --green: oklch(0.91 0.045 145);
  --green-deep: oklch(0.43 0.085 145);
  --yellow: oklch(0.94 0.06 82);
  --yellow-deep: oklch(0.46 0.1 65);
  --shadow: 14px 18px 0 color-mix(in oklch, oklch(0.91 0.045 15) 42%, transparent);
  --shadow-soft: 0 12px 32px color-mix(in oklch, var(--text) 8%, transparent);
  --radius-lg: 8px 28px 8px 28px;
  --radius-md: 18px;
  --radius-sm: 999px;
  --hq-display: Georgia, "Songti SC", "STSong", "SimSun", serif;
}
html { background: var(--page); }
body {
  min-height: 100dvh;
  background-color: var(--page);
  background-image: url("custom/huqin-background.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  font-size: 16px;
}
.cloud-background { background: color-mix(in oklch, var(--page) 28%, transparent); }
.cloud-background::after { background: color-mix(in oklch, var(--page) 24%, transparent); }
::selection { color: var(--text); background: var(--pink); }
:focus-visible { outline-color: var(--blue); }
h1, h2, .brand-lockup, .sidebar-brand strong { font-family: var(--hq-display); }
h1 { font-weight: 500; letter-spacing: -.045em; }
h2 { font-weight: 600; letter-spacing: -.025em; }
.eyebrow, .section-kicker { color: var(--blue-deep); }
.button, .icon-button, .day-option {
  border-radius: 999px;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}
.button.primary {
  color: oklch(0.25 0.035 20);
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: none;
}
.button.primary:hover:not(:disabled) { background: oklch(0.68 0.19 31); }
.button.secondary { color: var(--text); border-color: var(--line); background: color-mix(in oklch, var(--surface-solid) 74%, transparent); }
.button.secondary:hover:not(:disabled) { background: var(--surface-solid); border-color: var(--blue); }
.button.danger { color: var(--pink-deep); border-color: var(--pink-deep); background: transparent; }
.field { color: var(--text); }
.field input { min-height: 50px; color: var(--text); border-color: var(--line-strong); border-radius: 13px; background: color-mix(in oklch, var(--surface-solid) 90%, transparent); }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in oklch, var(--blue) 18%, transparent); }
.password-control .icon-button { color: var(--blue-deep); }

.login-shell { min-height: 100dvh; padding: 40px 28px; }
.login-card {
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr);
  width: min(1080px, 100%);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.login-art {
  min-height: 590px;
  padding: 36px 42px 28px;
  overflow: visible;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.login-art::after { right: 2%; bottom: 16%; width: 240px; height: 240px; border-color: color-mix(in oklch, var(--blue) 36%, transparent); border-radius: 46% 54% 52% 48%; transform: rotate(12deg); }
.brand-lockup { font-size: 28px; font-weight: 600; }
.brand-lockup small { color: var(--blue-deep); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
.login-art-copy { margin-top: 68px; }
.login-art-copy h2 { max-width: 520px; font-size: clamp(38px, 4.2vw, 56px); font-weight: 500; line-height: 1.22; }
.login-art-copy p { max-width: 360px; color: var(--muted); }
.login-mascot { right: 0; bottom: 30px; width: min(280px, 54%); max-height: 275px; filter: drop-shadow(0 16px 18px rgba(93,52,47,.09)); animation: hq-admin-drift 8s ease-in-out infinite alternate; }
.admin-login-bow { position: absolute; left: 4%; bottom: 74px; width: 112px; transform: rotate(-10deg); }
.art-note { color: var(--muted); border-color: var(--line); border-radius: 999px; background: color-mix(in oklch, var(--surface-solid) 52%, transparent); }
.login-form-wrap { align-self: end; margin: 0 0 34px -20px; padding: 38px 36px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.login-form-wrap h1 { font-size: 38px; }
.security-note { color: var(--muted); }

.admin-layout { grid-template-columns: minmax(0, 1fr) 238px; gap: 28px; width: min(1560px, 100%); padding: 24px; }
.sidebar {
  grid-column: 2;
  grid-row: 1;
  top: 24px;
  height: calc(100dvh - 48px);
  padding: 26px 18px 20px;
  border-color: var(--line);
  border-radius: 6px 26px 6px 26px;
  background: color-mix(in oklch, var(--surface-solid) 72%, transparent);
  box-shadow: none;
}
.sidebar-brand { border-bottom-color: var(--line); }
.sidebar-brand strong { font-size: 30px; font-weight: 600; }
.sidebar-brand small { color: var(--blue-deep); }
.side-nav { gap: 2px; margin-top: 28px; }
.nav-link { min-height: 50px; padding-inline: 8px; color: var(--muted); border: 0; border-bottom: 1px solid transparent; border-radius: 0; }
.nav-link > span { width: 24px; color: var(--blue-deep); }
.nav-link:hover, .nav-link.active { color: var(--blue-deep); border-color: var(--blue); background: transparent; }
.sidebar-bottom p { color: var(--muted); font-family: var(--hq-display); font-size: 13px; }
.workspace { grid-column: 1; grid-row: 1; padding: 12px 0 28px; }
.workspace-header { padding: 12px 0 30px 3vw; border-bottom: 1px solid var(--line); }
.workspace-header h1 { font-size: clamp(42px, 5vw, 68px); }
.workspace-header p { color: var(--muted); }
.session-chip, .soft-badge { color: var(--text); border-color: var(--line); background: color-mix(in oklch, var(--surface-solid) 56%, transparent); }
.section-block, .panel { scroll-margin-top: 28px; }
.section-heading { margin: 22px 0 14px; }
.stats-grid { gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat-card { min-height: 116px; padding: 20px 22px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; background: transparent; }
.stat-card:last-child { border-right: 0; }
.stat-card strong { font-family: var(--hq-display); font-size: 40px; font-weight: 500; }
.stat-icon { display: block; width: auto; height: auto; flex: 0 0 auto; border-radius: 0; background: transparent !important; color: var(--blue-deep) !important; font-family: var(--hq-display); font-size: 26px; }
.stat-active, .stat-unused, .stat-revoked, .stat-total { background: transparent; }
.dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(260px, .75fr); gap: 18px; margin-top: 24px; }
.panel { padding: 26px; border-color: var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: none; backdrop-filter: blur(12px); }
.generator-panel { box-shadow: 10px 12px 0 color-mix(in oklch, var(--pink) 42%, transparent); }
.days-fieldset legend { color: var(--text); }
.day-option { min-height: 46px; color: var(--muted); border-color: var(--line); background: transparent; }
.day-option.selected { color: oklch(0.25 0.035 20); border-color: var(--blue); background: var(--blue); box-shadow: none; }
.flow-panel { position: relative; overflow: hidden; background: color-mix(in oklch, var(--pink) 35%, transparent); }
.flow-panel::after { content: ''; position: absolute; right: -12px; bottom: -18px; width: 130px; height: 130px; background: url("custom/素材2/08_草莓奶油蛋糕.png") center / contain no-repeat; opacity: .5; pointer-events: none; }
.flow-list { position: relative; z-index: 1; }
.flow-list li > span { color: var(--blue-deep); border-color: var(--blue); border-radius: 50%; background: var(--surface-solid); }
.flow-list li:not(:last-child)::after { background: var(--line); }
.flow-list p { color: var(--muted); }
.cards-panel { margin-top: 24px; }
.license-card { padding: 20px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.license-card:hover { border-color: var(--blue); box-shadow: none; }
.license-hint { color: var(--blue-deep); }
.license-meta dd { color: var(--text); }
.license-actions { border-top-color: var(--line); }
.status-badge { border: 1px solid currentColor; background: transparent; }
.status-expired { color: var(--muted); background: transparent; }
.loading-state, .empty-state { color: var(--muted); }
.loading-dot { border-color: var(--line); border-top-color: var(--blue); }
.password-panel { margin-top: 24px; }
.workspace-footer { color: var(--muted); }
.dialog { color: var(--text); border-color: var(--line); border-radius: var(--radius-lg); background: var(--surface-solid); box-shadow: 0 26px 80px color-mix(in oklch, var(--text) 22%, transparent); }
.dialog::backdrop { background: color-mix(in oklch, var(--text) 40%, transparent); }
.generated-card { color: var(--blue-deep); border-color: var(--blue); background: var(--pink); }
.toast-region .toast { color: var(--text); border-color: var(--line); background: var(--surface-solid); }
@keyframes hq-admin-drift { from { transform: translateY(0) rotate(-1deg); } to { transform: translateY(-9px) rotate(1deg); } }

@media (max-width: 1120px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr) 210px; gap: 20px; padding: 18px; }
  .workspace-header { padding-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .flow-panel::after { opacity: .32; }
}
@media (max-width: 820px) {
  body { background-attachment: scroll; }
  .login-card { grid-template-columns: 1fr; width: min(620px, 100%); }
  .login-art { min-height: 350px; padding: 28px; }
  .login-art-copy { margin-top: 36px; }
  .login-art-copy h2 { font-size: 38px; }
  .login-mascot { width: 180px; max-height: 180px; }
  .admin-login-bow { width: 80px; bottom: 40px; }
  .login-form-wrap { margin: -20px 20px 0; padding: 30px; }
  .admin-layout { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .sidebar { position: static; grid-column: 1; grid-row: 1; height: auto; padding: 16px; }
  .sidebar-brand { padding-bottom: 12px; }
  .side-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
  .nav-link { justify-content: center; padding-inline: 4px; text-align: center; }
  .sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
  .sidebar-bottom p { margin: 0; }
  .sidebar-bottom .button { width: auto; }
  .workspace { grid-column: 1; grid-row: 2; }
  /* 窄屏长页使用稳定的不透明纸面，避免大面积离屏 backdrop-filter 出现空白。 */
  .panel {
    background: rgba(255, 253, 250, .96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
@media (max-width: 560px) {
  .login-shell { padding: 18px 14px 30px; }
  .login-art { min-height: 285px; padding: 22px 12px; }
  .brand-lockup { font-size: 24px; }
  .login-art-copy { margin-top: 24px; }
  .login-art-copy h2 { max-width: 260px; font-size: 31px; }
  .login-art-copy p { max-width: 210px; font-size: 13px; }
  .login-mascot { width: 138px; max-height: 142px; }
  .admin-login-bow, .art-note { display: none; }
  .login-form-wrap { margin: -12px 8px 0; padding: 26px 20px; }
  .login-form-wrap h1 { font-size: 32px; }
  .admin-layout { padding: 10px; }
  .side-nav { grid-template-columns: 1fr; }
  .nav-link { justify-content: flex-start; padding-inline: 10px; }
  .sidebar-bottom p { display: none; }
  .sidebar-bottom .button { width: 100%; }
  .workspace-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  .workspace-header h1 { font-size: 44px; }
  .header-actions { width: 100%; justify-content: space-between; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 100px; padding: 16px 12px; gap: 10px; }
  .stat-card strong { font-size: 34px; }
  .panel { padding: 20px 16px; }
  .panel-heading, .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .day-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .generate-row { grid-template-columns: 1fr; }
  .custom-days { max-width: none; }
  .license-card-header { align-items: flex-start; }
  .license-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .license-actions { justify-content: flex-start; }
  .password-panel { grid-template-columns: 1fr; gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-mascot { animation: none; }
  .button, .icon-button, .day-option { transition: 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; }
