/* 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;
  }
}
