:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --panel: #16191e;
  --panel-soft: #20252b;
  --panel-strong: #111419;
  --text: #edf2f7;
  --muted: #98a4b3;
  --line: #323a45;
  --accent: #14b8a6;
  --accent-strong: #0d9488;
  --warn: #f59e0b;
  --danger: #f87171;
  --done: #4ade80;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(20, 184, 166, 0.12), transparent 30%),
    linear-gradient(180deg, #111419 0%, var(--bg) 42%);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px 18px;
  max-width: 1440px;
  margin: 0 auto 14px;
}

.topbar > .tool-switcher {
  grid-column: 1;
  grid-row: 1;
  width: min(460px, 100%);
}

.topbar > .brand-lockup {
  grid-column: 1;
  grid-row: 2;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.28));
}

.brand-copy {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.topbar p,
.page-description {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.page-description {
  max-width: 640px;
}

.tool-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.tool-switcher-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 0;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.tool-switcher-link:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.tool-switcher-link.is-active {
  color: #fff;
  background: var(--accent);
}

.tool-switcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.tool-switcher-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.topbar-actions,
.status-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: start;
}

.topbar-help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(250, 204, 21, 0.86);
  border-radius: 999px;
  background: #facc15;
  color: #1f2937;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(250, 204, 21, 0.18);
}

.topbar-help-button:hover,
.topbar-help-button:focus {
  border-color: #fef08a;
  background: #fde047;
  color: #111827;
}

.auth-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
}

.auth-user-pill[hidden] {
  display: none !important;
}

#auth-login-button[hidden] {
  display: none !important;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.mode-tabs {
  display: flex;
  gap: 6px;
  max-width: 1440px;
  margin: 0 auto 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow-x: auto;
}

.utility-hidden {
  display: none !important;
}

.auth-overlay[hidden] {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(8px);
}

.auth-dialog {
  position: relative;
  width: min(420px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-dialog h2 {
  margin: 0;
  font-size: 20px;
}

.auth-dialog p {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
}

.auth-error {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.2);
  color: #fecaca;
}

.auth-error[hidden] {
  display: none !important;
}

.tab-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.tab-button.is-active {
  background: var(--accent);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
}

.control-panel,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 14px;
}

.mode-form {
  display: none;
}

.mode-form.is-active {
  display: block;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span,
.field label,
.field > label {
  color: var(--muted);
  font-size: 13px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.mode-form textarea[name="prompt"] {
  height: 66px;
  min-height: 66px;
  transition: height 150ms ease, min-height 150ms ease;
  scrollbar-color: rgba(245, 158, 11, 0.74) rgba(10, 15, 23, 0.54);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.mode-form textarea[name="prompt"].has-content {
  height: 118px;
  min-height: 118px;
}

.mode-form textarea[name="prompt"]::-webkit-scrollbar {
  width: 10px;
}

.mode-form textarea[name="prompt"]::-webkit-scrollbar-track {
  margin: 6px 3px;
  border-radius: 999px;
  background: rgba(10, 15, 23, 0.58);
}

.mode-form textarea[name="prompt"]::-webkit-scrollbar-thumb {
  min-height: 28px;
  border: 2px solid rgba(10, 15, 23, 0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.86), rgba(180, 83, 9, 0.82));
}

.mode-form textarea[name="prompt"]::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.92), rgba(217, 119, 6, 0.9));
}

.mode-form textarea[name="prompt"]::-webkit-scrollbar-corner {
  background: transparent;
}

input[type="file"] {
  width: 100%;
  min-height: 38px;
  padding: 7px;
  border: 1px dashed #596575;
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
}

.image-dropzone {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 190px;
  padding: 12px;
  border: 1px dashed #596575;
  border-radius: 8px;
  background: var(--panel-strong);
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.image-dropzone.has-preview {
  padding: 0;
  overflow: hidden;
  border-style: solid;
}

.image-dropzone:hover,
.image-dropzone:focus,
.image-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(20, 184, 166, 0.08);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.image-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-dropzone-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 160px;
  color: var(--muted);
  text-align: center;
}

.image-dropzone-empty[hidden] {
  display: none !important;
}

.image-dropzone-empty strong {
  color: var(--text);
  font-size: 16px;
}

.image-dropzone-guidance {
  max-width: 260px;
  color: #7d8795;
  font-size: 12px;
  line-height: 1.45;
}

.image-preview-grid {
  position: relative;
  display: block;
  width: 100%;
  min-height: 190px;
  background: #090b0e;
}

.image-preview-grid[hidden] {
  display: none !important;
}

.image-preview-grid.is-four-view-preview {
  min-height: 260px;
}

.image-preview-item {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 220px;
  margin: 0;
  overflow: hidden;
  background: #090b0e;
}

.image-preview-main {
  width: 100%;
  min-height: 260px;
}

.image-preview-item img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  object-fit: contain;
  object-position: center center;
}

.image-preview-item figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-height: 30px;
  padding: 6px 9px;
  overflow: hidden;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(9, 11, 14, 0.94);
  color: #e5e7eb;
  font-size: 12px;
}

.image-add-angle-button {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px 0 8px;
  border: 1px solid rgba(250, 204, 21, 0.55);
  border-radius: 999px;
  background: rgba(10, 12, 15, 0.78);
  color: #fde68a;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}

.image-add-angle-button:hover {
  border-color: rgba(250, 204, 21, 0.85);
  background: rgba(24, 28, 34, 0.92);
}

.image-add-angle-button:disabled {
  cursor: default;
  opacity: 0.54;
}

.image-add-angle-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #facc15;
  color: #171a20;
  font-size: 16px;
  line-height: 1;
}

.image-angle-strip {
  position: absolute;
  bottom: 38px;
  left: 8px;
  z-index: 4;
  display: flex;
  gap: 6px;
  max-width: calc(100% - 16px);
  overflow-x: auto;
  padding: 2px;
}

.image-angle-strip[hidden] {
  display: none !important;
}

.four-view-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-height: 260px;
  padding: 6px;
  background: #05070a;
}

.four-view-preview-item {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 120px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: #000;
}

.four-view-preview-item img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center center;
  background: #000;
}

.four-view-preview-item figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 6px;
  overflow: hidden;
  background: rgba(9, 11, 14, 0.94);
  color: #e5e7eb;
  font-size: 11px;
}

.four-view-preview-label,
.four-view-preview-resolution {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.four-view-preview-resolution {
  color: #9ca3af;
}

.image-angle-item {
  position: relative;
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 7px;
  background: #0b0e12;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.38);
}

.image-angle-item img {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
  object-position: center center;
}

.image-angle-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  display: inline-grid;
  place-items: center;
  width: 18px;
  min-height: 18px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(5, 7, 10, 0.82);
  color: #fff;
  font-size: 14px;
  line-height: 1;
}

.image-angle-remove:hover {
  background: rgba(127, 29, 29, 0.92);
}

.image-angle-remove:disabled {
  cursor: default;
  opacity: 0.45;
  background: rgba(5, 7, 10, 0.58);
}

.image-preview-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview-resolution {
  min-width: 70px;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.image-clear-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 7, 10, 0.72);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.image-clear-button:hover {
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(18, 22, 28, 0.9);
}

.image-clear-button:disabled {
  cursor: default;
  opacity: 0.45;
  background: rgba(5, 7, 10, 0.52);
}

.image-clear-button[hidden] {
  display: none !important;
}

.four-view-panel {
  margin-top: 10px;
  border: 1px solid rgba(250, 204, 21, 0.28);
  border-radius: 6px;
  background: rgba(250, 204, 21, 0.05);
}

.four-view-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  color: #fde68a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.four-view-panel summary::-webkit-details-marker {
  display: none;
}

.four-view-panel summary::after {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid currentColor;
  opacity: 0.72;
  transition: transform 160ms ease, opacity 160ms ease;
}

.four-view-panel[open] summary::after {
  transform: rotate(90deg);
}

.four-view-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.four-view-control-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.four-view-resolution-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #d1d5db;
  font-size: 11px;
  font-weight: 800;
}

.four-view-resolution-field select {
  width: 100%;
  min-height: 38px;
  padding: 0 24px 0 9px;
  border: 1px solid rgba(250, 204, 21, 0.5);
  border-radius: 7px;
  background: #10141b;
  color: #f9fafb;
  font-size: 13px;
  font-weight: 900;
}

.four-view-resolution-field select:disabled {
  cursor: default;
  opacity: 0.62;
}

.four-view-generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  min-width: 0;
  border: 1px solid rgba(250, 204, 21, 0.7);
  border-radius: 7px;
  background: #facc15;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(250, 204, 21, 0.16);
}

.four-view-generate-button:hover:not(:disabled) {
  border-color: #fef08a;
  background: #fde047;
  color: #fff;
}

.four-view-generate-button:disabled {
  cursor: default;
  opacity: 0.56;
  color: #fff;
  box-shadow: none;
}

.four-view-generate-button.is-busy {
  opacity: 0.86;
}

.four-view-generate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.four-view-generate-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
}

.four-view-price {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 12px;
}

.four-view-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 520px) {
  .four-view-control-row {
    grid-template-columns: 1fr;
  }
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

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

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

.advanced-panel {
  margin: 2px 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.advanced-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

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

.advanced-panel summary::after {
  content: "";
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 7px solid var(--muted);
  transition: transform 160ms ease, border-right-color 160ms ease;
}

.advanced-panel summary:hover::after {
  border-right-color: var(--text);
}

.advanced-panel[open] summary::after {
  transform: rotate(-90deg);
}

.advanced-panel[open] {
  padding-bottom: 10px;
}

.advanced-panel > .grid-2,
.advanced-panel > .bbox-grid,
.advanced-panel > .field {
  padding: 0 10px;
}

.advanced-panel > .grid-2,
.advanced-panel > .bbox-grid {
  margin-top: 10px;
}

.advanced-panel > .field {
  margin-top: 10px;
  margin-bottom: 0;
}

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

.toggle-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
}

.file-list {
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.file-list[hidden] {
  display: none !important;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.primary-button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 800;
}

.button-price {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #eafffb;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button:hover,
.tab-button.is-active:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button.is-missing-image,
.primary-button.is-missing-image:hover {
  border-color: #4a515b;
  background: #363d46;
  color: #aeb7c4;
  opacity: 1;
  box-shadow: none;
}

.primary-button.is-missing-image .button-price {
  background: rgba(148, 163, 184, 0.16);
  color: #c4ccd8;
}

.secondary-button {
  background: var(--panel-strong);
  color: var(--text);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.ghost-button:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.result-panel {
  display: grid;
  grid-auto-rows: auto;
  gap: 12px;
  padding: 14px;
}

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

.task-strip > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.task-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.restore-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(240px, 1.6fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.restore-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.restore-field span {
  color: var(--muted);
  font-size: 12px;
}

.restore-field textarea {
  min-height: 38px;
  resize: vertical;
}

.status-panel,
.downloads-panel,
.history-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-strong);
}

.status-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.status-heading h2,
.history-panel h2 {
  margin: 0;
  font-size: 16px;
}

.history-count {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.46);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.package-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.package-actions[hidden] {
  display: none !important;
}

.package-material-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.package-material-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 9px 0 7px;
  border: 1px solid #3e4652;
  border-radius: 6px;
  background: #20262e;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.package-material-button:hover {
  border-color: #64748b;
  background: #28313b;
}

.package-material-button.is-active {
  border-color: #facc15;
  background: #34301d;
  color: #f8e8a0;
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.18);
}

.package-material-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.package-material-logo {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a313a;
}

#progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.status-summary {
  min-height: 34px;
  padding-top: 10px;
  color: var(--text);
  font-weight: 600;
}

.status-list {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.status-bottom-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.status-bottom-actions[hidden] {
  display: none !important;
}

.status-start-new-button {
  min-height: 34px;
  padding-inline: 14px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.status-chip.done {
  border-color: rgba(74, 222, 128, 0.32);
  color: var(--done);
  background: rgba(22, 101, 52, 0.18);
}

.status-chip.failed {
  border-color: rgba(248, 113, 113, 0.32);
  color: var(--danger);
  background: rgba(127, 29, 29, 0.22);
}

.status-chip.running {
  border-color: rgba(245, 158, 11, 0.32);
  color: var(--warn);
  background: rgba(120, 53, 15, 0.22);
}

.message-log {
  min-height: 82px;
  max-height: 180px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: #090b0e;
  color: #b7f7e8;
  white-space: pre-wrap;
}

.job-progress {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.job-progress.done {
  border-color: rgba(74, 222, 128, 0.32);
  background: rgba(22, 101, 52, 0.18);
}

.job-progress.failed {
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(127, 29, 29, 0.22);
}

.job-progress.running {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(120, 53, 15, 0.22);
}

.job-progress-meta {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.job-progress-meta span {
  color: var(--muted);
  font-size: 12px;
}

.job-progress-meta strong {
  font-size: 13px;
}

.job-progress-meta small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a313a;
}

.job-progress-track > div {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.job-progress.done .job-progress-track > div {
  background: var(--done);
}

.job-progress.failed .job-progress-track > div {
  background: var(--danger);
}

.preview-zone {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.preview-zone img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.model-viewer-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.model-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.model-viewer-head h3 {
  margin: 0;
  font-size: 15px;
}

.model-download-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.model-download-info {
  max-width: min(52vw, 520px);
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-download-info[hidden] {
  display: none !important;
}

.three-viewer {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(220px, 1fr));
  gap: 1px;
  width: 100%;
  min-height: 520px;
  background: #1a1b1c;
}

.three-viewer.is-maximized {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(520px, 1fr);
}

.three-viewport {
  position: relative;
  min-width: 0;
  min-height: 220px;
  overflow: hidden;
  background:
    linear-gradient(rgba(12, 12, 12, 0.92), rgba(12, 12, 12, 0.92)) 50% 50% / 2px 100% no-repeat,
    linear-gradient(90deg, rgba(12, 12, 12, 0.92), rgba(12, 12, 12, 0.92)) 50% 50% / 100% 2px no-repeat,
    repeating-linear-gradient(0deg, rgba(78, 80, 81, 0.56) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, rgba(78, 80, 81, 0.56) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(0deg, transparent 0 59px, rgba(98, 100, 101, 0.62) 59px 60px),
    repeating-linear-gradient(90deg, transparent 0 59px, rgba(98, 100, 101, 0.62) 59px 60px),
    #303132;
}

.three-viewer.is-maximized .three-viewport {
  display: none;
}

.three-viewer.is-maximized .three-viewport.is-active-viewport {
  display: block;
  min-height: 520px;
}

.three-viewport[data-viewport="perspective"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 24%),
    linear-gradient(180deg, #202020 0%, #2d2e2e 55%, #3b3c3c 100%);
}

.three-viewer.is-grid-hidden .three-viewport {
  background: #303132;
}

.three-viewer.is-grid-hidden .three-viewport[data-viewport="perspective"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 24%),
    linear-gradient(180deg, #202020 0%, #2d2e2e 55%, #3b3c3c 100%);
}

.three-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(8, 9, 10, 0.9);
}

.three-viewport.is-active-viewport::after {
  box-shadow: inset 0 0 0 2px rgba(157, 141, 72, 0.72);
}

.three-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.three-viewport-ui {
  position: absolute;
  top: 5px;
  right: 6px;
  z-index: 2;
  pointer-events: none;
}

.three-viewport-label {
  position: absolute;
  top: 5px;
  left: 6px;
  z-index: 2;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #c5c7c9;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  text-shadow: 0 1px 2px #050607;
  pointer-events: none;
}

.viewport-model-stats {
  position: absolute;
  top: 24px;
  left: 10px;
  z-index: 2;
  color: #d8bf16;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  text-shadow: 0 1px 2px #050607;
  pointer-events: none;
}

.viewport-model-stats[hidden] {
  display: none !important;
}

.viewport-dimension-label {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  min-width: 74px;
  padding: 4px 6px;
  border: 1px solid rgba(242, 239, 227, 0.82);
  border-radius: 3px;
  background: rgba(25, 26, 27, 0.78);
  color: #f2efe3;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-shadow: 0 1px 2px #050607;
  pointer-events: none;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.viewport-dimension-label[hidden] {
  display: none !important;
}

.viewport-channel-menu {
  position: relative;
  display: flex;
  justify-content: flex-end;
  pointer-events: auto;
}

.viewport-channel-trigger,
.viewport-channel-option {
  min-height: 22px;
  border: 1px solid rgba(141, 145, 148, 0.38);
  border-radius: 3px;
  background: rgba(23, 24, 25, 0.68);
  color: #c8cbcd;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 1px #050607;
  white-space: nowrap;
  pointer-events: auto;
}

.viewport-channel-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
}

.viewport-channel-trigger::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.78;
}

.viewport-channel-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 126px;
  padding: 4px;
  border: 1px solid rgba(141, 145, 148, 0.46);
  border-radius: 4px;
  background: rgba(22, 23, 24, 0.94);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.36);
}

.viewport-channel-list[hidden] {
  display: none !important;
}

.viewport-channel-option {
  width: 100%;
  padding: 0 8px;
  text-align: left;
  background: transparent;
}

.viewport-channel-trigger:hover,
.viewport-channel-option:hover {
  border-color: rgba(210, 214, 217, 0.7);
  color: #fff;
  background: rgba(49, 51, 53, 0.78);
}

.viewport-channel-option.is-active {
  border-color: rgba(252, 211, 77, 0.78);
  background: rgba(157, 141, 72, 0.76);
  color: #fff9d7;
}

.three-viewer-empty {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(38, 40, 42, 0.36);
  color: #e2e5e8;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.36);
}

.three-viewer-empty[hidden] {
  display: none !important;
}

.three-viewer-empty.is-hidden {
  display: none !important;
}

.download-list {
  min-width: 0;
  margin-top: 10px;
}

.download-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.download-showcase-card {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.download-showcase-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 260px;
  object-fit: cover;
  background: linear-gradient(180deg, #303437, #1e2225);
}

.download-showcase-card figcaption {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.download-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.download-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

.download-table th,
.download-table td {
  min-width: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  vertical-align: middle;
}

.download-table th {
  color: var(--muted);
  font-weight: 700;
  background: var(--panel-strong);
}

.download-table th:nth-child(1),
.download-table td:nth-child(1) {
  width: 76px;
}

.download-table th:nth-child(3),
.download-table td:nth-child(3) {
  width: 132px;
}

.download-table th:nth-child(4),
.download-table td:nth-child(4),
.download-table th:nth-child(5),
.download-table td:nth-child(5) {
  width: 104px;
}

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

.download-file-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-thumb,
.download-thumb-placeholder {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
}

.download-thumb {
  display: block;
  object-fit: cover;
}

.history-list {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 106px;
  margin-top: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  scrollbar-width: thin;
}

.history-list::-webkit-scrollbar {
  height: 6px;
}

.history-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.history-item {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 86px;
  display: grid;
  grid-template-rows: 86px auto;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.history-thumb-wrap {
  position: relative;
  display: block;
  width: 86px;
  height: 86px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)), #22272c;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.history-item:hover .history-thumb-wrap,
.history-item:focus-visible .history-thumb-wrap {
  border-color: rgba(255, 220, 112, 0.6);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  transform: translateY(-1px);
}

.history-item.is-active .history-thumb-wrap {
  border-color: rgba(255, 215, 92, 0.96);
  box-shadow: 0 0 0 2px rgba(255, 215, 92, 0.28), 0 12px 28px rgba(0, 0, 0, 0.44);
}

.history-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.44);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.history-thumb-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 32px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.48));
  pointer-events: none;
}

.history-index {
  position: absolute;
  left: 5px;
  bottom: 5px;
  z-index: 2;
  min-width: 18px;
  min-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(5, 7, 10, 0.68);
  color: rgba(255, 255, 255, 0.86);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.history-split-mark {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 3;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 215, 92, 0.5);
  border-radius: 5px;
  background: rgba(15, 17, 20, 0.72);
  color: #ffd75c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.history-status-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  max-width: calc(100% - 10px);
  overflow: hidden;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(12, 16, 20, 0.78);
  color: rgba(255, 255, 255, 0.88);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item.is-status-done .history-status-badge {
  color: #b9f8c6;
  background: rgba(22, 101, 52, 0.68);
}

.history-item.is-status-failed .history-status-badge {
  color: #ffd2d2;
  background: rgba(127, 29, 29, 0.72);
}

.history-item.is-status-pending .history-status-badge,
.history-item.is-status-running .history-status-badge {
  color: #ffe4a3;
  background: rgba(120, 53, 15, 0.72);
}

.history-item.is-status-running .history-thumb,
.history-item.is-status-pending .history-thumb {
  filter: brightness(0.72) saturate(0.85);
}

.history-time {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-context-menu {
  position: fixed;
  z-index: 90;
  min-width: 126px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: #171c22;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46);
}

.history-context-menu[hidden] {
  display: none !important;
}

.history-context-menu-item {
  appearance: none;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.history-context-menu-item:hover,
.history-context-menu-item:focus-visible {
  background: rgba(245, 158, 11, 0.16);
  color: #ffd75c;
  outline: none;
}

.history-context-menu-item:disabled {
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.36);
  background: transparent;
}

.item-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.empty-line {
  color: var(--muted);
}

.auth-user-pill .ghost-button {
  width: auto;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
}

.auth-dialog-card {
  width: min(460px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  border: 1px solid #3b434d;
  border-radius: 8px;
  background: #15191f;
  box-shadow: var(--shadow);
}

.auth-dialog-card[hidden] {
  display: none !important;
}

.auth-dialog-card-wide {
  width: min(1120px, 100%);
}

.auth-dialog-card-recharge,
.auth-dialog-card-bank {
  width: min(620px, 100%);
}

.auth-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #11151b;
}

.auth-dialog-header h3 {
  margin: 0;
  font-size: 18px;
}

.auth-dialog-close {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
}

.auth-dialog-close:hover {
  color: var(--text);
  background: #2a3038;
}

.auth-dialog-body {
  padding: 18px;
  overflow: auto;
}

.auth-dialog-card-wide .auth-dialog-body {
  max-height: calc(100vh - 108px);
}

.auth-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

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

.auth-field-side-link {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}

.auth-input {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1318;
  color: var(--text);
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
}

.auth-login-error {
  padding: 9px 10px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
}

.auth-login-error[hidden] {
  display: none !important;
}

.auth-dialog-actions {
  padding: 0 18px 18px;
}

.auth-dialog-actions-single .auth-confirm-button {
  width: 100%;
  min-height: 42px;
}

.auth-notice-text {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

.auth-profile-body {
  display: grid;
  gap: 14px;
}

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

.auth-profile-summary-card,
.auth-record-card,
.auth-share-metric,
.auth-promotion-stats-card,
.auth-promotion-rule {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10141a;
}

.auth-profile-summary-card {
  min-height: 94px;
  padding: 14px;
}

.auth-profile-summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-profile-summary-value {
  margin-top: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  word-break: break-word;
}

.auth-profile-credit-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.auth-profile-recharge-button,
.auth-profile-free-credits-button,
.auth-promotion-bank-button,
.auth-promotion-withdraw-button,
.auth-promotion-copy-button,
.auth-promotion-stats-refresh,
.auth-promotion-stats-tab,
.auth-recharge-pay-button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
}

.auth-profile-recharge-button,
.auth-recharge-pay-button,
.auth-promotion-copy-button {
  border-color: rgba(20, 184, 166, 0.45);
  background: rgba(20, 184, 166, 0.16);
  color: #9cf2e8;
}

.auth-profile-free-credits-button,
.auth-promotion-withdraw-button {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.14);
  color: #facc15;
}

.auth-profile-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1318;
  overflow-x: auto;
}

.auth-profile-tab {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.auth-profile-tab.is-active {
  background: var(--accent);
  color: #fff;
}

.auth-profile-panels {
  min-height: 360px;
}

.auth-profile-panel {
  max-height: 420px;
  overflow: auto;
  padding: 10px;
}

.auth-profile-panel[hidden] {
  display: none !important;
}

.auth-record-empty,
.auth-recharge-placeholder,
.auth-record-table-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.auth-record-table {
  --auth-record-table-columns: minmax(130px, 1fr) minmax(150px, 1fr) minmax(100px, 0.7fr);
  min-width: 620px;
}

.auth-record-table-login {
  --auth-record-table-columns: minmax(130px, 1fr) minmax(150px, 1fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr);
}

.auth-record-table-recharge,
.auth-record-table-promotion {
  --auth-record-table-columns: minmax(130px, 1fr) minmax(150px, 1fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr);
}

.auth-record-table-head,
.auth-record-row {
  display: grid;
  grid-template-columns: var(--auth-record-table-columns);
}

.auth-record-table-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-record-head-cell,
.auth-record-cell {
  min-width: 0;
  padding: 10px;
}

.auth-record-row {
  border-bottom: 1px solid rgba(50, 58, 69, 0.72);
}

.auth-record-row:last-child {
  border-bottom: 0;
}

.auth-record-cell-primary,
.auth-record-cell-muted,
.auth-record-item-time,
.auth-record-item-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.auth-record-cell-primary {
  color: var(--text);
}

.auth-consume-amount {
  display: block;
  font-weight: 800;
}

.auth-consume-amount.is-minus {
  color: #fda4af;
}

.auth-consume-amount.is-plus {
  color: #86efac;
}

.auth-consume-table {
  min-width: 900px;
}

.auth-consume-table-head,
.auth-consume-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(150px, 1fr) minmax(100px, 0.75fr) minmax(170px, 1.2fr) 78px 78px minmax(100px, 0.8fr);
}

.auth-consume-table-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-consume-head-cell,
.auth-consume-cell {
  min-width: 0;
  padding: 10px;
}

.auth-consume-row {
  border-bottom: 1px solid rgba(50, 58, 69, 0.72);
}

.auth-consume-thumb {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #0b0e12;
}

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

.auth-consume-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.auth-consume-status-label {
  display: block;
  font-weight: 800;
}

.auth-consume-status.is-success .auth-consume-status-label {
  color: var(--done);
}

.auth-consume-status.is-failed .auth-consume-status-label {
  color: var(--warn);
}

.auth-recharge-module {
  display: grid;
  gap: 14px;
}

.auth-recharge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-recharge-desc {
  color: var(--muted);
  line-height: 1.55;
}

.auth-recharge-channel {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.16);
  color: #9cf2e8;
  font-weight: 800;
}

.auth-recharge-packages {
  display: grid;
  gap: 10px;
}

.auth-recharge-package {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10141a;
}

.auth-recharge-package-title,
.auth-recharge-package-price {
  font-weight: 800;
}

.auth-recharge-package-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  color: #facc15;
  font-size: 12px;
}

.auth-recharge-package-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-recharge-state {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #0f1318;
}

.auth-recharge-state.is-success {
  border-color: rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
}

.auth-recharge-state.is-warning,
.auth-recharge-state.is-loading {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.auth-recharge-state.is-error {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.auth-recharge-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1318;
}

.auth-recharge-qr[hidden] {
  display: none !important;
}

.auth-recharge-qr-card {
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.auth-recharge-qr-image {
  display: block;
  width: 210px;
  height: 210px;
}

.auth-recharge-qr-title {
  font-weight: 800;
}

.auth-recharge-qr-desc {
  color: var(--muted);
  font-size: 12px;
}

.auth-share-card {
  display: grid;
  gap: 12px;
}

.auth-promotion-rule {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.auth-promotion-rule-text {
  color: var(--muted);
  line-height: 1.55;
}

.auth-share-code-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.auth-share-code {
  min-width: 0;
  overflow: hidden;
  color: #9cf2e8;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-promotion-stats-card {
  padding: 12px;
}

.auth-promotion-stats-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.auth-promotion-stats-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.auth-promotion-stats-tab.is-active {
  border-color: rgba(20, 184, 166, 0.45);
  background: rgba(20, 184, 166, 0.18);
  color: #9cf2e8;
}

.auth-promotion-stats-grid,
.auth-share-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-promotion-stat,
.auth-share-metric {
  padding: 12px;
}

.auth-promotion-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1318;
}

.auth-promotion-stat span,
.auth-promotion-balance-line span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.auth-promotion-stat strong,
.auth-promotion-balance-line strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.auth-promotion-balance-lines {
  display: grid;
  gap: 10px;
}

.auth-promotion-balance-side-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-promotion-bank-form {
  margin: 0;
}

@media (max-width: 940px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar,
  .status-heading,
  .task-strip {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .topbar > .tool-switcher,
  .topbar > .brand-lockup,
  .topbar-actions {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    justify-self: stretch;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .topbar-actions,
  .status-actions,
  .package-actions {
    width: 100%;
  }

  .package-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .package-material-switch {
    flex-wrap: wrap;
  }

  .auth-profile-summary,
  .auth-promotion-stats-grid,
  .auth-share-grid {
    grid-template-columns: 1fr;
  }

  .auth-dialog-card-wide .auth-dialog-body {
    max-height: calc(100vh - 92px);
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

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

  .grid-2,
  .bbox-grid,
  .toggle-grid,
  .job-progress-meta,
  .three-viewer,
  .restore-panel {
    grid-template-columns: 1fr;
  }

  .three-viewer {
    grid-template-rows: repeat(4, 220px);
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .topbar-help-button {
    width: 100%;
  }

  .package-actions,
  .package-material-switch,
  .package-material-button {
    width: 100%;
  }

  .package-material-button {
    justify-content: center;
  }

  .model-viewer-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .model-download-meta {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .model-download-info {
    max-width: 100%;
  }

  .download-showcase {
    grid-template-columns: 1fr;
  }

  .download-showcase-card img {
    min-height: 0;
  }

  .auth-user-pill {
    width: 100%;
    justify-content: space-between;
  }

  .auth-user-pill .ghost-button {
    width: auto;
  }

  .auth-dialog-card {
    max-height: calc(100vh - 20px);
  }

  .auth-recharge-head,
  .auth-recharge-package,
  .auth-recharge-package-side,
  .auth-share-code-line,
  .auth-promotion-stats-head {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .auth-record-table,
  .auth-consume-table {
    min-width: 0;
  }

  .auth-record-table-head,
  .auth-consume-table-head {
    display: none;
  }

  .auth-record-row,
  .auth-consume-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 0;
  }

  .auth-record-cell,
  .auth-consume-cell {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px;
    padding: 4px 8px;
  }

  .auth-record-cell::before,
  .auth-consume-cell::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .auth-consume-thumb {
    width: 72px;
    height: 72px;
  }
}
