:root {
  --bg: #07111a;
  --surface-1: rgb(16 20 23 / 0.86);
  --surface-2: rgb(22 27 31 / 0.86);
  --surface-3: rgb(31 37 42 / 0.9);
  --surface-soft: rgb(9 13 16 / 0.74);
  --input: rgb(6 9 11 / 0.86);
  --border-hairline: rgb(222 230 235 / 0.1);
  --border-subtle: rgb(222 230 235 / 0.17);
  --border: rgb(205 216 222 / 0.27);
  --border-bright: rgb(214 224 230 / 0.42);
  --accent: #8acbf5;
  --accent-hover: #b1ddfa;
  --accent-soft: rgb(138 203 245 / 0.14);
  --on-accent: #0a1b27;
  --success: #9fb8a5;
  --warning: #d0ad76;
  --danger: #e1979b;
  --text: #f2f7fa;
  --text-secondary: #c5d1d8;
  --text-muted: #91a3ae;
  --shadow-panel: 0 28px 78px rgb(0 5 10 / 0.46), inset 0 1px rgb(255 255 255 / 0.065);
  --shadow-raised: 0 20px 52px rgb(0 5 10 / 0.36), inset 0 1px rgb(255 255 255 / 0.05);
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 16px;
  --gap: 16px;
  --font-body: "Microsoft YaHei", "微软雅黑", "Segoe UI", sans-serif;
  --font-heading: "Microsoft YaHei", "微软雅黑", "Segoe UI", sans-serif;
  --font-mono: "Microsoft YaHei", "微软雅黑", Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 140ms;
  --base: 200ms;
  color-scheme: dark;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  position: relative;
  isolation: isolate;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  text-rendering: auto;
  -webkit-font-smoothing: auto;
}

body::before,
body::after {
  position: fixed;
  z-index: -2;
  content: "";
  pointer-events: none;
}

body::before {
  inset: 0;
  background-color: var(--bg);
  background-image: url("image-background.jpg");
  background-position: calc(100% + var(--image-parallax-x, 0px)) calc(50% + var(--image-parallax-y, 0px));
  background-repeat: no-repeat;
  background-size: auto 100vh;
  transition: background-position 180ms ease-out;
}

body::after {
  inset: 0 34vw 0 0;
  z-index: -1;
  background: url("image-background.jpg") center 42% / cover no-repeat;
  filter: blur(24px) saturate(1.04);
  opacity: 0.88;
  transform: translate3d(var(--image-parallax-x, 0px), var(--image-parallax-y, 0px), 0) scale(1.06);
  transform-origin: left center;
  transition: transform 180ms ease-out;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 76%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 76%, transparent 100%);
}

button, input, textarea, select {
  font: inherit;
}

button, select, input[type="file"] {
  cursor: pointer;
}

button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button, a, input, textarea, select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

a {
  color: inherit;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1, h2, h3 {
  margin-bottom: 0;
  color: var(--text);
  font-family: var(--font-heading);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  font-weight: 730;
  line-height: 1.2;
  letter-spacing: -0.018em;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--on-accent);
  background: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgb(138 203 245 / 0.12);
}

.scanlines {
  display: none;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  min-height: 44px;
  padding: 10px 16px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--fast) ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.terminal-label, .terminal-code, .section-kicker, .fact-index, .job-id, .meta-chip, .status-badge, .nav-count, .mobile-count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.035em;
}

.terminal-label, .terminal-code, .section-kicker {
  color: var(--text-muted);
}

.section-kicker {
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.hud-panel {
  position: relative;
}

.panel,
.login-shell,
.job-card,
.user-card,
.gallery-card,
.modal-frame,
.toast {
  border: 1px solid var(--border);
  background: var(--surface-1);
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(22px) saturate(1.04);
  backdrop-filter: blur(22px) saturate(1.04);
}

.panel {
  position: relative;
  border-radius: var(--radius-lg);
}

.boot-screen, .login-screen {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 24px;
}

.boot-screen {
  align-content: center;
  gap: 16px;
  text-align: center;
}

.boot-mark, .brand-mark {
  display: grid;
  place-items: center;
  border: 1px solid rgb(138 203 245 / 0.34);
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 1px rgb(255 255 255 / 0.09);
  font-weight: 700;
}

.boot-mark {
  width: 58px;
  height: 58px;
  border-radius: 13px;
  font-size: 24px;
}

.boot-title {
  font-size: clamp(2.4rem, 8vw, 4.5rem);
  letter-spacing: -0.035em;
}

.glitch-once::before, .glitch-once::after {
  display: none;
}

.boot-line {
  overflow: hidden;
  width: min(260px, 72vw);
  height: 4px;
  border-radius: 99px;
  background: rgb(255 255 255 / 0.14);
}

.boot-line span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
}

.motion-enabled .boot-line span {
  animation: motion-progress-in 760ms var(--ease-out) 1 both;
}

.login-screen {
  align-content: center;
}

.login-shell {
  width: min(940px, 100%);
  overflow: hidden;
  border-color: var(--border-bright);
  border-radius: var(--radius-lg);
}

.terminal-bar {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgb(10 14 17 / 0.68);
}

.terminal-lights {
  display: none;
}

.terminal-bar .terminal-code {
  margin-left: auto;
}

.login-content {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
}

.login-intro {
  padding: clamp(32px, 6vw, 72px);
  border-right: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, rgb(255 255 255 / 0.025), transparent 55%);
}

.login-intro > p {
  max-width: 31rem;
  margin: 18px 0 32px;
  color: var(--text-secondary);
  font-size: 15px;
}

.system-facts {
  display: grid;
  gap: 10px;
}

.login-intro > .system-facts {
  margin-top: 32px;
}

.system-facts > div {
  display: grid;
  min-height: 46px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--surface-soft);
}

.fact-index {
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(28px, 5vw, 54px);
  background: rgb(9 13 16 / 0.46);
}

.login-foot {
  margin: 16px 0 0;
  color: var(--text-muted);
  text-align: center;
  text-shadow: 0 2px 12px rgb(0 0 0 / 0.9);
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group > label, .label-row label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-hint {
  color: var(--text-muted);
  font-size: 13px;
}

input, textarea, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--input);
  box-shadow: inset 0 1px rgb(255 255 255 / 0.025);
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease, background-color var(--fast) ease;
}

input, select {
  padding: 0 13px;
}

textarea {
  min-height: 142px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.7;
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.78;
}

input:hover, textarea:hover, select:hover {
  border-color: var(--border-bright);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  background: rgb(5 8 10 / 0.94);
  box-shadow: 0 0 0 3px rgb(138 203 245 / 0.09);
}

.button {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform var(--fast) var(--ease-out), border-color var(--fast) ease, box-shadow var(--fast) ease, color var(--fast) ease, background-color var(--fast) ease;
}

.button-primary {
  color: var(--on-accent);
  border-color: rgb(218 238 251 / 0.45);
  background: var(--accent);
  box-shadow: inset 0 1px rgb(255 255 255 / 0.3), 0 7px 22px rgb(9 38 57 / 0.24);
}

.button-primary::after {
  position: absolute;
  top: -45%;
  bottom: -45%;
  left: -36%;
  width: 24%;
  content: "";
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.38), transparent);
  opacity: 0;
  transform: skewX(-20deg) translateX(-180%);
  pointer-events: none;
}

.motion-enabled .button-primary.motion-sweep::after {
  animation: motion-button-sweep 680ms var(--ease-out) 260ms 1 both;
}

.button-ghost {
  color: var(--text-secondary);
  border-color: var(--border);
  background: rgb(255 255 255 / 0.018);
}

.button-danger {
  color: #f3c5c8;
  border-color: rgb(225 151 155 / 0.42);
  background: rgb(225 151 155 / 0.1);
}

.button-wide {
  width: 100%;
}

.button-compact {
  min-width: 44px;
  padding-inline: 12px;
  font-size: 13px;
}

.text-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 700;
}

.form-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.form-message.is-error {
  color: #f4c9cc;
  border-color: rgb(225 151 155 / 0.42);
  background: rgb(225 151 155 / 0.09);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 64px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgb(9 13 16 / 0.84);
  box-shadow: 0 8px 30px rgb(0 5 10 / 0.22);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
  backdrop-filter: blur(24px) saturate(1.08);
}

.topbar-inner {
  display: flex;
  width: min(1440px, 100%);
  min-height: 64px;
  align-items: center;
  gap: clamp(18px, 3vw, 36px);
  margin-inline: auto;
  padding-inline: clamp(18px, 3vw, 32px);
}

.brand-lockup {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  font-size: 15px;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.desktop-nav {
  display: flex;
  min-height: 64px;
  align-items: stretch;
  gap: 4px;
}

.nav-button {
  position: relative;
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  font-weight: 700;
  transition: color var(--fast) ease, background-color var(--fast) ease;
}

.nav-button::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  content: "";
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity var(--fast) ease, transform var(--fast) ease;
}

.nav-button.is-active {
  color: var(--accent);
}

.nav-button.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-count, .mobile-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  margin-left: 6px;
  padding: 0 4px;
  border: 1px solid rgb(138 203 245 / 0.34);
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
  letter-spacing: 0;
}

.account-cluster {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.header-quota {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-right: 14px;
  border-right: 1px solid var(--border-subtle);
}

.header-quota strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 17px;
}

.account-copy {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.account-copy strong {
  overflow: hidden;
  max-width: 140px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy span {
  color: var(--text-muted);
  font-size: 12px;
}

.content-shell {
  width: min(1440px, 100%);
  margin-inline: auto;
  padding: 34px clamp(18px, 3vw, 32px) 64px;
}

.page-heading {
  display: flex;
  min-height: 92px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.page-heading h1,
.page-heading .section-kicker,
.system-state {
  text-shadow: 0 2px 14px rgb(0 0 0 / 0.94), 0 1px 2px rgb(0 0 0 / 0.9);
}

.system-state, .sync-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.state-divider {
  width: 1px;
  height: 14px;
  margin-inline: 5px;
  background: var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.is-ok, .status-dot.is-live {
  background: var(--success);
  box-shadow: 0 0 0 3px rgb(159 184 165 / 0.1);
}

.status-dot.is-error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgb(225 151 155 / 0.1);
}

.view-panel {
  min-width: 0;
}

.generate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  align-items: start;
  gap: var(--gap);
}

.generator-panel, .recent-panel, .create-user-panel, .users-panel {
  padding: clamp(20px, 2.6vw, 28px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.panel-heading .terminal-label {
  display: block;
  margin-bottom: 5px;
}

.panel-heading p, .gallery-toolbar p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.compact-heading {
  align-items: center;
  margin-bottom: 14px;
}

.mode-switch {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.mode-button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
  font-weight: 700;
  transition: color var(--fast) ease, background-color var(--fast) ease, box-shadow var(--fast) ease;
}

.mode-button.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgb(138 203 245 / 0.28);
}

.prompt-field {
  margin-top: 2px;
}

.drop-zone {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius);
  background: var(--surface-soft);
  transition: border-color var(--fast) ease, background-color var(--fast) ease, box-shadow var(--fast) ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgb(138 203 245 / 0.24);
}

.file-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.drop-zone.has-file .file-input {
  display: none;
}

.upload-empty {
  display: grid;
  min-height: 132px;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 20px;
  color: var(--text-muted);
  text-align: center;
}

.upload-empty strong {
  color: var(--text-secondary);
}

.upload-glyph {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  margin-bottom: 6px;
  border: 1px solid rgb(138 203 245 / 0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 22px;
}

.upload-preview {
  display: grid;
  min-height: 128px;
  gap: 12px;
  padding: 14px;
}

.upload-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-item {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 4px;
}

.upload-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  object-fit: cover;
}

.upload-order {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--accent);
  background: rgb(14 20 28 / 0.82);
  font-family: var(--font-mono);
  font-size: 12px;
}

.upload-caption {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgb(14 20 28 / 0.82);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.upload-remove:hover, .upload-remove:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.upload-actions .field-hint {
  flex: 1 1 200px;
  min-width: 0;
}

.model-field {
  margin-top: 20px;
}

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

.quota-panel {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface-soft);
  -webkit-backdrop-filter: blur(14px) saturate(1.02);
  backdrop-filter: blur(14px) saturate(1.02);
}

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

.quota-heading .terminal-label {
  display: block;
  margin-bottom: 4px;
}

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

.quota-grid > div {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border-left: 1px solid var(--border);
  background: rgb(255 255 255 / 0.025);
}

.quota-grid span {
  color: var(--text-muted);
  font-size: 12px;
}

.quota-grid strong {
  font-family: var(--font-mono);
  font-size: 17px;
}

.quota-grid > div:nth-child(3) strong {
  color: var(--accent);
}

.quota-track {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 7px;
  margin-top: 14px;
  border: 0;
  border-radius: 99px;
  color: var(--accent);
  background: rgb(255 255 255 / 0.14);
  appearance: none;
}

.quota-track::-webkit-progress-bar {
  border-radius: 99px;
  background: rgb(255 255 255 / 0.14);
}

.quota-track::-webkit-progress-value {
  border-radius: 99px;
  background: var(--accent);
  transform-origin: left center;
}

.quota-track::-moz-progress-bar {
  border-radius: 99px;
  background: var(--accent);
  transform-origin: left center;
}

.motion-enabled .quota-track.motion-progress::-webkit-progress-value {
  animation: motion-progress-in 720ms var(--ease-out) 160ms 1 both;
}

.motion-enabled .quota-track.motion-progress::-moz-progress-bar {
  animation: motion-progress-in 720ms var(--ease-out) 160ms 1 both;
}

.quota-panel > p {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.quota-panel > p.is-over-limit {
  color: var(--danger);
}

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.submit-row p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.recent-panel {
  position: sticky;
  top: 80px;
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-job {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius);
  color: var(--text);
  background: rgb(8 12 15 / 0.58);
  text-align: left;
  transition: transform var(--base) var(--ease-out), border-color var(--fast) ease, box-shadow var(--fast) ease, background-color var(--fast) ease;
}

.recent-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.recent-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-meta, .job-meta, .user-meta, .meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.empty-state, .loading-state, .error-state {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state p, .loading-state p, .error-state p {
  margin: 0;
}

.compact-empty {
  min-height: 230px;
}

.empty-index {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.04em;
  opacity: 0.6;
}

.error-state {
  color: var(--danger);
}

.loader {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
}

.queue-heading {
  align-items: center;
  margin: 0;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.heading-actions, .gallery-actions, .modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.queue-list {
  display: grid;
  gap: var(--gap);
  padding: 24px;
}

.job-card, .user-card, .gallery-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-raised);
  transition: transform var(--base) var(--ease-out), border-color var(--fast) ease, box-shadow var(--fast) ease, background-color var(--fast) ease;
}

.job-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
}

.job-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.job-card-main {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.job-id {
  color: var(--text-muted);
}

.job-prompt {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.job-card-actions {
  display: flex;
  min-width: 128px;
  align-items: flex-end;
  justify-content: space-between;
  flex-direction: column;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  background: var(--surface-soft);
  letter-spacing: 0.025em;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  content: "";
  background: currentColor;
}

.status-badge.is-queued {
  color: var(--warning);
  border-color: rgb(208 173 118 / 0.34);
  background: rgb(208 173 118 / 0.08);
}

.status-badge.is-running {
  color: #9bb9cc;
  border-color: rgb(155 185 204 / 0.34);
  background: rgb(155 185 204 / 0.08);
}

.status-badge.is-completed {
  color: var(--success);
  border-color: rgb(159 184 165 / 0.34);
  background: rgb(159 184 165 / 0.08);
}

.status-badge.is-failed {
  color: var(--danger);
  border-color: rgb(225 151 155 / 0.38);
  background: rgb(225 151 155 / 0.09);
}

.status-badge.is-partial, .status-badge.is-neutral {
  color: var(--text-muted);
}

.result-strip {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 3px 3px 6px;
  scrollbar-color: var(--border-bright) transparent;
}

.result-thumb {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-error {
  margin: 0;
  padding: 9px 11px;
  border-left: 2px solid var(--danger);
  color: #f4c9cc;
  background: rgb(225 151 155 / 0.08);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: var(--gap);
  padding: 20px 22px;
}

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

.gallery-span {
  grid-column: 1 / -1;
}

.gallery-card {
  overflow: hidden;
}

.gallery-thumb {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-soft);
  aspect-ratio: 1 / 1;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.gallery-card-body {
  display: grid;
  gap: 12px;
  padding: 13px 14px 14px;
}

.gallery-prompt {
  display: -webkit-box;
  min-height: 43px;
  overflow: hidden;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gallery-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.meta-chip {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid var(--border-hairline);
  border-radius: 5px;
  color: var(--text-muted);
  background: var(--surface-soft);
  letter-spacing: 0.02em;
}

.download-link {
  min-height: 36px;
  padding-inline: 10px;
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.pagination span {
  min-width: 100px;
  color: var(--text-secondary);
  text-align: center;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

.create-user-panel {
  position: sticky;
  top: 80px;
  display: grid;
  gap: 18px;
}

.create-user-panel .panel-heading {
  margin-bottom: 0;
}

.panel-note {
  margin: -4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.users-panel {
  padding: 0;
  overflow: hidden;
}

.users-list {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.user-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.user-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.user-identity {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.user-identity strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.user-controls {
  display: grid;
  /* 两个编辑框（每日额度、有效期）各占一列，后面是启停和重置密码两个按钮 */
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  padding-top: 13px;
  border-top: 1px solid var(--border-hairline);
}

.quota-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.quota-editor input {
  min-width: 0;
}

.modal {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: visible;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: rgb(12 16 19 / 0.94);
  box-shadow: 0 35px 100px rgb(0 0 0 / 0.72);
}

.modal::backdrop {
  background: rgb(2 6 9 / 0.76);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}

.modal-frame {
  position: relative;
  max-height: calc(100dvh - 34px);
  overflow: auto;
  border: 0;
  border-radius: inherit;
  background: var(--surface-1);
}

.modal-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgb(12 16 19 / 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.modal-bar .terminal-label {
  display: block;
  margin-bottom: 4px;
}

.modal-bar h2 {
  font-size: 18px;
}

.modal-close {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--input);
  font-family: var(--font-mono);
  font-size: 22px;
  transition: transform var(--fast) var(--ease-out), border-color var(--fast) ease, background-color var(--fast) ease;
}

.image-stage {
  display: grid;
  min-height: 360px;
  max-height: 66dvh;
  place-items: center;
  overflow: hidden;
  padding: 16px;
  background: rgb(6 9 11 / 0.9);
}

.image-stage img {
  max-width: 100%;
  max-height: calc(66dvh - 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.48);
}

.image-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 18px;
  padding: 18px 20px 20px;
  border-top: 1px solid var(--border-subtle);
}

.image-detail > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.job-modal {
  width: min(760px, calc(100vw - 32px));
}

.job-dialog-content {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-grid > div {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.detail-grid span {
  color: var(--text-muted);
  font-size: 12px;
}

.detail-grid strong {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
}

.detail-prompt {
  margin: 0;
  padding: 13px;
  border-left: 2px solid var(--accent);
  color: var(--text-secondary);
  background: rgb(138 203 245 / 0.055);
  overflow-wrap: anywhere;
}

.detail-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-result {
  display: grid;
  gap: 8px;
}

.detail-result button {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  aspect-ratio: 1 / 1;
}

.detail-result img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reset-modal {
  width: min(500px, calc(100vw - 32px));
}

.reset-modal .modal-frame {
  display: grid;
  gap: 18px;
  padding-bottom: 20px;
}

.reset-modal .modal-frame > p, .reset-modal .field-group, .reset-modal .form-message, .reset-modal .modal-actions {
  margin-right: 20px;
  margin-left: 20px;
}

.reset-modal .modal-frame > p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

.modal-actions {
  justify-content: flex-end;
}

.toast-region {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 100;
  display: grid;
  width: min(380px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  position: relative;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px 11px 0;
  border-color: var(--border-bright);
  border-radius: var(--radius);
  background: rgb(18 23 27 / 0.94);
  pointer-events: auto;
}

.toast::before {
  width: 4px;
  height: 100%;
  border-radius: 10px 0 0 10px;
  content: "";
  background: var(--accent);
}

.toast.is-error {
  border-color: rgb(225 151 155 / 0.48);
}

.toast.is-error::before {
  background: var(--danger);
}

.toast p {
  margin: 0;
  overflow-wrap: anywhere;
}

.toast button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  font-size: 20px;
}

.mobile-nav {
  display: none;
}

.noscript-message {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 10001;
  padding: 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: #f4c9cc;
  background: rgb(45 21 23 / 0.96);
  text-align: center;
}

.motion-enabled .motion-reveal {
  opacity: 0;
  transform: translateY(12px) scale(0.992);
}

.motion-enabled .motion-reveal.is-motion-visible {
  animation: motion-reveal-in 560ms var(--ease-out) var(--motion-delay, 0ms) 1 both;
}

.motion-glow {
  --spot-x: -600px;
  --spot-y: -600px;
  position: relative;
  isolation: isolate;
}

.motion-glow::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  content: "";
  background: radial-gradient(320px circle at var(--spot-x) var(--spot-y), rgb(138 203 245 / 0.1), transparent 65%);
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .button:hover:not(:disabled), .modal-close:hover:not(:disabled) {
    transform: translateY(-1px);
  }

  .button-primary:hover:not(:disabled) {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    box-shadow: inset 0 1px rgb(255 255 255 / 0.32), 0 9px 25px rgb(7 28 42 / 0.3);
  }

  .button-ghost:hover:not(:disabled), .modal-close:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--border-bright);
    background: rgb(255 255 255 / 0.055);
  }

  .button-danger:hover:not(:disabled) {
    border-color: var(--danger);
    background: rgb(225 151 155 / 0.15);
  }

  .nav-button:hover, .mobile-nav-button:hover, .text-button:hover {
    color: var(--text);
  }

  .mode-button:hover:not(.is-active) {
    color: var(--text-secondary);
    background: rgb(255 255 255 / 0.045);
  }

  .recent-job:hover, .job-card:hover, .gallery-card:hover, .user-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-bright);
    background-color: rgb(28 34 39 / 0.9);
    box-shadow: 0 24px 58px rgb(0 5 10 / 0.4), inset 0 1px rgb(255 255 255 / 0.06);
  }

  .result-thumb:hover, .detail-result button:hover, .gallery-thumb:hover {
    box-shadow: inset 0 0 0 1px rgb(138 203 245 / 0.62);
  }
}

@media (max-width: 1120px) {
  .generate-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

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

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

  .header-quota .terminal-label {
    display: none;
  }
}

@media (max-width: 900px) {
  body::before {
    background-position: calc(58% + var(--image-parallax-x, 0px)) calc(50% + var(--image-parallax-y, 0px));
    background-size: auto 100vh;
  }

  body::after {
    right: 24vw;
  }

  .desktop-nav {
    display: none;
  }

  .content-shell {
    padding-bottom: 104px;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 68px;
    padding: 4px max(6px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--border-subtle);
    background: rgb(9 13 16 / 0.9);
    box-shadow: 0 -12px 35px rgb(0 5 10 / 0.34);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  .mobile-nav-button {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 56px;
    place-items: center;
    align-content: center;
    gap: 1px;
    padding: 3px 4px;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: transparent;
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-nav-button.is-active {
    color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgb(138 203 245 / 0.2);
  }

  .mobile-nav-glyph {
    font-family: var(--font-mono);
    font-size: 17px;
    line-height: 1;
  }

  .mobile-count {
    position: absolute;
    top: 3px;
    right: calc(50% - 28px);
    margin: 0;
  }

  .generate-layout, .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .recent-panel, .create-user-panel {
    position: static;
  }

  .recent-panel {
    order: 2;
  }

  .users-panel {
    order: 1;
  }

  .create-user-panel {
    order: 2;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  body::before {
    background-position: center center;
    background-size: cover;
    transition: none;
  }

  body::after {
    display: none;
  }

  .topbar-inner {
    gap: 12px;
    padding-inline: 14px;
  }

  .brand-name {
    display: none;
  }

  .account-copy {
    display: none;
  }

  .header-quota {
    padding-right: 10px;
  }

  .content-shell {
    padding: 22px 14px 96px;
  }

  .page-heading {
    min-height: 76px;
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .system-state {
    display: none;
  }

  .panel-heading, .queue-heading, .gallery-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .generator-panel, .recent-panel, .create-user-panel {
    padding: 18px;
  }

  .mode-switch {
    width: 100%;
  }

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

  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .submit-row .button {
    width: 100%;
  }

  .queue-heading {
    padding: 18px;
  }

  .heading-actions, .gallery-actions {
    justify-content: space-between;
  }

  .queue-list, .users-list {
    padding: 14px;
  }

  .job-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .job-card-actions {
    min-width: 0;
    align-items: center;
    flex-direction: row;
  }

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

  .user-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .quota-editor {
    grid-column: 1 / -1;
  }

  .image-stage {
    min-height: 260px;
  }

  .image-detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-detail .button {
    width: 100%;
  }

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

@media (max-width: 620px) {
  .login-screen {
    padding: 12px;
  }

  .login-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-intro {
    padding: 28px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .login-form {
    padding: 24px 22px 28px;
  }

  .login-intro > p {
    margin-bottom: 22px;
  }

  .system-facts > div {
    grid-template-columns: 30px minmax(0, 1fr);
  }

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

  .upload-list {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }

  .upload-actions {
    justify-content: stretch;
  }

  .upload-actions .button {
    flex: 1 1 120px;
  }
}

@media (max-width: 460px) {
  .header-quota {
    border-right: 0;
  }

  .account-cluster {
    gap: 7px;
  }

  .account-cluster .button {
    padding-inline: 10px;
  }

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

  .gallery-thumb {
    aspect-ratio: 4 / 3;
  }

  .gallery-toolbar, .queue-heading {
    padding: 16px;
  }

  .user-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .quota-editor {
    grid-column: auto;
  }

  .user-controls .button {
    width: 100%;
  }

  .heading-actions, .gallery-actions, .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions .button, .gallery-actions .button, .modal-actions .button {
    width: 100%;
  }

  .detail-grid, .detail-results {
    grid-template-columns: minmax(0, 1fr);
  }

  .pagination {
    gap: 8px;
  }

  .pagination .button {
    padding-inline: 11px;
  }
}

@keyframes motion-reveal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes motion-progress-in {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes motion-button-sweep {
  0% {
    opacity: 0;
    transform: skewX(-20deg) translateX(-180%);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: skewX(-20deg) translateX(720%);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  body::before {
    background-position: right center !important;
  }

  body::after {
    transform: scale(1.06) !important;
  }

  .motion-reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .button-primary::after {
    display: none !important;
  }
}

html[data-hd-power="low"] *, html[data-hd-power="low"] *::before, html[data-hd-power="low"] *::after,
html[data-hd-motion="off"] *, html[data-hd-motion="off"] *::before, html[data-hd-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}

@media (forced-colors: active) {
  .button, input, textarea, select, .panel, .job-card, .gallery-card, .user-card, .modal {
    border: 1px solid ButtonText;
  }

  .status-dot, .status-badge::before {
    forced-color-adjust: none;
  }
}
