:root {
  --bg: #f4f7fb;
  --bg-soft: #eef6f5;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #d8e0ea;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #2563eb;
  --danger: #b42318;
  --ok: #067647;
  --warning: #b45309;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(15, 118, 110, 0.12), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(37, 99, 235, 0.1), transparent 30%),
    var(--bg);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #0e7490);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.24);
}

.button-primary:hover {
  background: linear-gradient(135deg, var(--primary-strong), #155e75);
}

.button-secondary,
.button-ghost {
  color: #1f2937;
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
}

.button-secondary:hover,
.button-ghost:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow-sm);
}

.stretch {
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, var(--primary));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgba(216, 224, 234, 0.82);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #334155;
  font-weight: 750;
}

.nav-login {
  color: var(--primary-strong);
}

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  align-items: center;
  gap: clamp(30px, 5vw, 76px);
  padding: clamp(44px, 7vw, 90px) clamp(20px, 5vw, 72px) 58px;
}

.hero h1,
.section-title h2,
.control-band h2,
.auth-intro h1,
.workspace-header h1,
.admin-hero h1 {
  margin: 0;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.02;
}

.hero-text {
  max-width: 640px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 640px;
  margin-top: 34px;
}

.hero-metrics div {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-sm);
}

.hero-metrics strong {
  font-size: 24px;
}

.hero-metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hero-visual {
  position: relative;
  min-height: 570px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.asset-landing {
  background-image:
    linear-gradient(180deg, rgba(15, 23, 42, 0.02), rgba(15, 23, 42, 0.64)),
    url("/assets/generated/landing-hero.png"),
    linear-gradient(135deg, #dff7f5, #edf5ff);
  background-position: center;
  background-size: cover;
}

.hero-glass-panel {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius);
  padding: 18px;
  color: #fff;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(16px);
}

.hero-glass-panel strong {
  font-size: 23px;
}

.hero-glass-panel small {
  color: #dbeafe;
  font-weight: 700;
}

.visual-chip {
  width: max-content;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ok);
  background: #ecfdf3;
  font-size: 13px;
  font-weight: 900;
}

.section-stack,
.control-band {
  padding: 70px clamp(20px, 5vw, 72px);
}

.section-title {
  max-width: 760px;
}

.section-title h2,
.control-band h2 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.workflow-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 30px;
}

.workflow-cards article,
.control-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-sm);
}

.workflow-cards span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  background: #0f172a;
  font-weight: 900;
}

.workflow-cards h3 {
  margin: 18px 0 10px;
  font-size: 22px;
}

.workflow-cards p,
.control-band p,
.control-grid span {
  color: var(--muted);
  line-height: 1.75;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  gap: 32px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 118, 110, 0.9)),
    #0f172a;
}

.control-band .eyebrow,
.control-band p,
.control-grid span {
  color: #cbd5e1;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.control-grid div {
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.control-grid strong {
  display: block;
  margin-bottom: 8px;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(380px, 520px);
}

.single-auth {
  grid-template-columns: minmax(320px, 1fr) minmax(380px, 520px);
}

.auth-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 6vw, 76px);
  color: #fff;
  background-image:
    linear-gradient(90deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.7)),
    url("/assets/generated/auth-visual.png"),
    linear-gradient(135deg, #0f172a, #164e63);
  background-position: center;
  background-size: cover;
}

.auth-intro .brand-mark {
  color: #0f172a;
  background: #fff;
}

.auth-intro-copy {
  max-width: 640px;
  margin: auto 0;
}

.auth-intro h1 {
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.05;
}

.auth-intro p {
  max-width: 590px;
  color: #dbe5f0;
  font-size: 17px;
  line-height: 1.8;
}

.auth-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-proof span {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 8px 12px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.auth-card {
  align-self: center;
  width: min(440px, calc(100% - 36px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: #eaf0f7;
  margin-bottom: 22px;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.segmented button.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.12);
}

.auth-form,
.generation-form,
.result-panel {
  display: grid;
  gap: 16px;
}

.auth-form h2,
.surface h2 {
  margin: 0;
  font-size: 22px;
}

.auth-form p,
.surface p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

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

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.password-toggle {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.password-meter {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.password-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--danger);
  transition: width 0.2s ease, background 0.2s ease;
}

.password-meter span[data-score="3"],
.password-meter span[data-score="4"] {
  background: var(--ok);
}

.hidden {
  display: none;
}

.form-message {
  min-height: 20px;
  max-height: 72px;
  overflow: auto;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--danger);
  line-height: 1.5;
  font-size: 13px;
}

.app-page {
  display: grid;
  grid-template-columns: 268px 1fr;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.sidebar {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 22px;
  backdrop-filter: blur(16px);
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  border-radius: 7px;
  padding: 11px 12px;
  color: #475569;
  font-weight: 800;
}

.side-nav a.active,
.side-nav a:hover {
  color: var(--primary-strong);
  background: #e8f7f4;
}

.sidebar-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #f8fafc;
}

.sidebar-card strong {
  display: block;
  margin-bottom: 10px;
}

.sidebar-card ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 14px;
}

.sidebar .button {
  margin-top: auto;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 20px;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 28px;
}

.workspace-header,
.surface-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.workspace-header h1,
.admin-hero h1 {
  font-size: 34px;
}

.workspace-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.user-pill {
  min-width: 230px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
  text-align: right;
  box-shadow: var(--shadow-sm);
}

.user-pill span {
  font-weight: 900;
}

.user-pill small {
  color: var(--muted);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.metric-card,
.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  font-size: 32px;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 22vw, 380px);
  gap: 20px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.workspace-tabs {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-sm);
}

.workspace-tabs button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 18px;
  color: #475569;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.workspace-tabs button.active,
.workspace-tabs button:hover {
  color: var(--primary-strong);
  border-color: rgba(15, 118, 110, 0.22);
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.workspace-panel {
  display: none;
  min-height: 0;
  overflow: hidden;
}

.workspace-panel.active {
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

#tab-image.active,
#tab-profile.active {
  display: block;
}

#tab-image.active {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#tab-video.active {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.workspace-panel-grid {
  display: grid;
  gap: 20px;
  min-width: 0;
  min-height: 0;
}

.image-panel-grid {
  grid-template-columns: minmax(220px, 2fr) minmax(0, 6fr) minmax(220px, 2fr);
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

#tab-video > .video-panel-grid {
  grid-template-columns: minmax(220px, 2fr) minmax(0, 6fr) minmax(220px, 2fr);
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.image-params-panel,
.image-preview-panel,
.image-tasks-panel,
.video-params-panel,
.video-preview-panel,
.video-tasks-panel {
  height: 100%;
  min-height: 0;
}

.image-params-panel,
.video-params-panel {
  display: grid;
  grid-template-rows: auto;
  align-content: start;
  overflow: auto;
}

.image-params-panel > label:not(.upload-zone),
.video-params-panel > label:not(.upload-zone) {
  min-height: 0;
  display: grid;
  align-content: stretch;
  gap: 8px;
}

.image-params-panel .image-effect-field,
.video-params-panel .image-effect-field {
  grid-template-rows: auto auto;
}

.image-params-panel textarea,
.video-params-panel textarea {
  min-height: 180px;
  height: clamp(180px, 28dvh, 320px);
  resize: none;
}

.video-preview-panel {
  display: grid;
  grid-template-rows: auto auto minmax(104px, 0.9fr) minmax(96px, 1fr);
  align-content: stretch;
  gap: 12px;
  overflow: hidden;
}

.result-panel.video-preview-panel::before {
  display: none;
}

.video-draft-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.video-draft-grid label {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.video-draft-grid textarea {
  min-height: 78px;
  height: 100%;
  resize: none;
}

.video-preview-panel #videoBox {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.image-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}

.image-preview-panel .image-result-stack {
  min-height: 0;
  height: 100%;
  position: relative;
  display: block;
  overflow: hidden;
}

.image-preview-panel #imageResultBox {
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  overflow: hidden;
  padding: 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.image-preview-panel #imageResultBox.empty-state {
  padding: 18px;
}

.image-preview-media {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  object-fit: contain;
}

.button.disabled,
.button[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.48;
  box-shadow: none;
  transform: none;
}

.image-tasks-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.image-task-list,
.video-task-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.image-task-item {
  width: 100%;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  color: var(--text);
  background: #fff;
  text-align: left;
}

.image-task-item.is-working {
  border-color: rgba(15, 118, 110, 0.32);
  background: linear-gradient(180deg, #ffffff, #f0fdfa);
}

.image-task-item:hover,
.image-task-item.active {
  border-color: rgba(15, 118, 110, 0.42);
  background: #f0fdfa;
}

.image-task-item.bad {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff7f7;
}

.image-task-main {
  width: 100%;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.image-task-item img,
.image-task-placeholder {
  width: 58px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
}

.image-task-placeholder .loader-ring {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

.image-task-copy {
  min-width: 0;
}

.image-task-copy strong,
.image-task-copy small {
  display: block;
}

.image-task-copy small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
  font-size: 12px;
  font-weight: 750;
}

.image-task-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.video-task-actions {
  grid-template-columns: 1fr 1fr;
}

.video-task-progress {
  display: grid;
  gap: 6px;
}

.video-task-progress span {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.video-task-progress span::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #2563eb);
  animation: pulse-progress 1.15s ease-in-out infinite;
}

.video-task-progress small {
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

@keyframes pulse-progress {
  0% {
    transform: translateX(-105%);
  }
  55% {
    transform: translateX(80%);
  }
  100% {
    transform: translateX(245%);
  }
}

.video-tasks-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.danger-button {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.24);
}

.danger-button:hover {
  background: #fef3f2;
}

.image-task-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
  font-weight: 800;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.profile-summary {
  grid-column: 1 / -1;
}

.profile-metrics {
  margin-top: 16px;
}

.compact-inline {
  min-height: 34px;
  margin-top: 8px;
  padding: 0 12px;
  font-size: 13px;
}

.thumb-frame {
  width: 64px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(37, 99, 235, 0.08)),
    #eef2f7;
}

.thumb-frame img {
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
  border-radius: inherit;
}

.thumb-frame.has-preview img {
  display: block;
}

.thumb-frame::before {
  content: "";
  width: 22px;
  height: 22px;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  background:
    linear-gradient(135deg, transparent 52%, rgba(15, 118, 110, 0.2) 53%),
    linear-gradient(45deg, transparent 58%, rgba(37, 99, 235, 0.18) 59%);
}

.thumb-frame.has-preview::before {
  display: none;
}

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

.image-result-stack {
  display: grid;
  gap: 12px;
}

.primary-workspace {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: none;
}

.primary-workspace::-webkit-scrollbar {
  display: none;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.95fr) minmax(380px, 1.05fr);
  gap: 20px;
  min-height: 0;
}

.surface {
  min-width: 0;
  min-height: 0;
  padding: 20px;
}

.badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: #475569;
  background: #eef2f7;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.ok {
  color: var(--ok);
  background: #ecfdf3;
}

.badge.bad {
  color: var(--danger);
  background: #fef3f2;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-steps-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.progress-steps li {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.progress-steps li.active {
  color: var(--primary-strong);
  border-color: rgba(15, 118, 110, 0.32);
  background: #e8f7f4;
}

.progress-steps li.done {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.upload-zone {
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(64px, 104px) 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px dashed #a8b6c8;
  border-radius: var(--radius);
  padding: 14px;
  background: linear-gradient(135deg, #fbfdff, #f3faf9);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.upload-zone.dragging {
  border-color: var(--primary);
  background: #e8f7f4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-zone:not(.has-image) .thumb-frame {
  opacity: 0.9;
}

.upload-preview-list {
  display: none;
  min-height: 88px;
  max-height: 144px;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #f8fafc;
}

.upload-preview-list.has-items {
  display: grid;
}

.upload-preview-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef2f7;
}

.upload-preview-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  cursor: zoom-in;
}

.upload-preview-item button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #fff;
  background: rgba(15, 23, 42, 0.76);
  cursor: pointer;
  font-size: 14px;
  line-height: 18px;
  font-weight: 900;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.72);
}

.image-preview-modal img {
  max-width: min(1120px, 94vw);
  max-height: 88vh;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  object-fit: contain;
}

.image-preview-modal-close {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  cursor: pointer;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.upload-zone strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.upload-zone small {
  color: var(--muted);
  line-height: 1.65;
}

.upload-remove-button {
  display: none;
  min-height: 34px;
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--danger);
  background: #fff;
  cursor: pointer;
  font-weight: 900;
}

.upload-zone.has-image .upload-remove-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.upload-remove-button:hover {
  background: #fef3f2;
}

.image-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.image-options label {
  grid-template-rows: auto auto;
}

.image-options select {
  min-height: 42px;
  height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}

.preset-panel {
  display: grid;
  gap: 10px;
}

.preset-panel > span {
  color: #334155;
  font-size: 14px;
  font-weight: 900;
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-list button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: #334155;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.preset-list button.active,
.preset-list button:hover {
  color: var(--primary-strong);
  border-color: rgba(15, 118, 110, 0.4);
  background: #e8f7f4;
}

.form-actions,
.result-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.inline-number {
  width: 112px;
  gap: 6px;
}

.inline-number input {
  min-height: 42px;
}

.generation-status {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: #134e4a;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
}

.generation-status.hidden {
  display: none;
}

.generation-status strong,
.generation-status small {
  display: block;
}

.generation-status small {
  margin-top: 2px;
  color: #475569;
  line-height: 1.5;
  font-weight: 700;
}

.loader-ring {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 3px solid rgba(15, 118, 110, 0.18);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.82s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.result-panel {
  position: relative;
  overflow: hidden;
}

.result-panel::before {
  content: "";
  display: block;
  height: 176px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.86)),
    url("/assets/generated/workspace-empty.png"),
    linear-gradient(135deg, #ecfeff, #eff6ff);
  background-position: center;
  background-size: cover;
}

.video-box {
  min-height: 58px;
  display: grid;
  gap: 10px;
}

.video-box video {
  width: 100%;
  max-height: 420px;
  border-radius: var(--radius);
  background: #0f172a;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.56);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 44px));
  display: grid;
  gap: 16px;
  overflow: auto;
}

.video-modal-panel textarea {
  min-height: 180px;
  resize: vertical;
}

.reference-editor {
  position: relative;
  display: grid;
}

.rich-prompt-editor {
  min-height: 180px;
  max-height: min(42vh, 360px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  caret-color: #0f766e;
}

.rich-prompt-editor::selection,
.rich-prompt-editor *::selection {
  background: rgba(59, 130, 246, 0.34);
  color: inherit;
}

.rich-prompt-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.rich-prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

.prompt-image-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(260px, 100%);
  border: 1px solid rgba(59, 130, 246, 0.5);
  border-radius: 8px;
  padding: 4px 7px 4px 4px;
  margin: 2px 4px 2px 0;
  color: #dbeafe;
  background: #123d8b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  vertical-align: middle;
  user-select: none;
}

.prompt-image-thumb,
.prompt-image-thumb img {
  width: 26px;
  height: 26px;
  border-radius: 5px;
}

.prompt-image-thumb img {
  display: block;
  object-fit: cover;
}

.prompt-image-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.prompt-image-token button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #bfdbfe;
  background: rgba(15, 23, 42, 0.42);
  cursor: pointer;
  font-weight: 900;
  line-height: 18px;
}

.reference-menu {
  position: absolute;
  left: 10px;
  top: 44px;
  z-index: 10;
  width: min(320px, calc(100% - 20px));
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(59, 130, 246, 0.45);
  border-radius: 8px;
  padding: 6px;
  background: #0f172a;
  box-shadow: var(--shadow);
}

.reference-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 7px;
  color: #e2e8f0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 850;
}

.reference-menu button:hover {
  background: rgba(59, 130, 246, 0.24);
}

.reference-menu img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
}

.reference-menu-empty {
  padding: 10px;
  color: #94a3b8;
  font-weight: 800;
}

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

.video-price-summary div {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: #f0fdfa;
}

.video-price-summary span,
.video-price-summary strong {
  display: block;
}

.video-price-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.video-price-summary strong {
  margin-top: 4px;
  color: var(--primary-strong);
  font-size: 18px;
}

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

.video-modal-grid input,
.video-modal-grid select {
  min-height: 42px;
}

.video-modal-grid small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.icon-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #334155;
  background: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.video-preview-panel .video-box:not(.empty-state) {
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: stretch;
}

.video-preview-panel .video-box video {
  height: 100%;
  min-height: 0;
  max-height: none;
  object-fit: contain;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.recent-jobs-panel {
  align-self: start;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  overscroll-behavior: contain;
}

.recent-jobs-panel .surface-head {
  align-items: center;
}

.recent-jobs-panel .surface-head p {
  font-size: 13px;
}

.recent-jobs-panel .table-wrap {
  overflow: visible;
}

.recent-jobs-panel table,
.recent-jobs-panel tbody,
.recent-jobs-panel tr,
.recent-jobs-panel td {
  display: block;
  width: 100%;
}

.recent-jobs-panel table {
  font-size: 13px;
}

.recent-jobs-panel thead {
  display: none;
}

.recent-jobs-panel tbody {
  display: grid;
  gap: 10px;
}

.recent-jobs-panel tbody tr {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.86);
}

.recent-jobs-panel tbody tr:hover {
  border-color: rgba(15, 118, 110, 0.28);
  background: #f8fafc;
}

.recent-jobs-panel td {
  border-bottom: 0;
  padding: 0;
}

.recent-jobs-panel td + td {
  margin-top: 8px;
}

.recent-jobs-panel td:nth-child(2) {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recent-jobs-panel td:nth-child(n + 3) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.recent-jobs-panel td:nth-child(3)::before {
  content: "冻结";
  font-weight: 900;
}

.recent-jobs-panel td:nth-child(4)::before {
  content: "扣费";
  font-weight: 900;
}

.recent-jobs-panel td:nth-child(5)::before {
  content: "创建";
  font-weight: 900;
}

.recent-jobs-note {
  cursor: default;
}

.recent-jobs-note td {
  color: var(--muted);
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #475569;
  background: var(--surface-2);
  font-weight: 900;
}

td {
  color: #334155;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fafc;
}

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: min(360px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-weight: 750;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(6, 118, 71, 0.26);
  color: var(--ok);
}

.toast.error {
  border-color: rgba(180, 35, 24, 0.26);
  color: var(--danger);
}

.admin-shell {
  width: min(1240px, calc(100% - 32px));
  display: grid;
  gap: 18px;
  margin: 28px auto;
}

.admin-hero {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(236, 253, 245, 0.84)),
    #fff;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-identity {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  color: #334155;
  background: #fff;
  font-size: 13px;
  font-weight: 850;
}

.admin-note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 750;
}

.admin-grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.admin-tabs-shell {
  padding: 0;
  overflow: hidden;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  overflow-x: auto;
}

.admin-tabs button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  color: #475569;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.admin-tabs button.active {
  color: var(--primary-strong);
  border-color: rgba(15, 118, 110, 0.24);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: none;
  padding: 20px;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
}

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

.sub-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
}

.inline-form {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.admin-grid label.full {
  grid-column: 1 / -1;
}

.settings-sections {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.settings-category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  background: #f8fafc;
}

.settings-category-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  color: #475569;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.settings-category-tabs button.active,
.settings-category-tabs button:hover {
  color: var(--primary-strong);
  border-color: rgba(15, 118, 110, 0.24);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.settings-category-panels {
  min-width: 0;
}

.settings-category-panel {
  display: none;
}

.settings-category-panel.active {
  display: grid;
  gap: 16px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-card-head h3 {
  margin: 0;
  font-size: 19px;
}

.settings-card-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-card-head span {
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--primary-strong);
  background: #e8f7f4;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.settings-block {
  display: grid;
  gap: 12px;
  border: 1px solid #e5edf6;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.settings-block-head h4 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
}

.settings-block-head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
  font-weight: 750;
}

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

.settings-field-grid label.full {
  grid-column: 1 / -1;
}

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

.settings-price-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.settings-price-card h5 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
}

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

.settings-field-grid small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.credit-row {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.recharge-code-form {
  grid-template-columns: minmax(160px, 0.45fr) minmax(160px, 0.45fr) minmax(220px, 1fr) auto;
}

.created-code {
  margin-top: 14px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--primary-strong);
  background: #e8f7f4;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-weight: 900;
  overflow-wrap: anywhere;
}

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

.credit-actions {
  min-width: 250px;
}

.amount-input {
  width: 92px;
  min-height: 38px;
  padding: 8px 10px;
}

.compact-button {
  min-height: 38px;
  padding: 0 12px;
}

#usageTables {
  display: grid;
  gap: 22px;
  margin-top: 18px;
}

#usageTables h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

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

  .workspace-layout .work-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 1180px) {
  .workspace-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .primary-workspace {
    overflow: visible;
    padding-right: 0;
  }

  .recent-jobs-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  #tab-video.active,
  #tab-image.active {
    display: block;
    height: 100%;
    overflow: auto;
  }

  #tab-video > .video-panel-grid,
  .image-panel-grid {
    grid-template-columns: 1fr;
    height: auto;
    align-items: start;
  }

  .image-params-panel,
  .image-preview-panel,
  .image-tasks-panel,
  .video-params-panel,
  .video-preview-panel,
  .video-tasks-panel {
    height: auto;
  }

  .image-preview-panel,
  .video-preview-panel {
    min-height: 520px;
  }

  .video-preview-panel {
    grid-template-rows: auto auto auto minmax(240px, auto);
    overflow: visible;
  }

  .video-preview-panel #videoBox {
    min-height: 240px;
    height: min(52vh, 420px);
  }

  .image-tasks-panel,
  .video-tasks-panel {
    height: min(70vh, 620px);
  }
}

@media (max-width: 1040px) {
  .hero,
  .control-band,
  .auth-layout,
  .app-page,
  .work-grid,
  .workspace-panel-grid,
  .metric-row,
  .workflow-cards,
  .control-grid,
  .admin-grid-layout,
  .tab-two-col,
  .recharge-code-form,
  .settings-field-grid,
  .settings-block .settings-field-grid,
  .settings-price-matrix,
  .settings-price-card .settings-field-grid {
    grid-template-columns: 1fr;
  }

  .settings-field-grid label.full {
    grid-column: auto;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .app-page {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .workspace {
    grid-template-rows: none;
    height: auto;
    overflow: visible;
  }

  .workspace-panel.active {
    height: auto;
    overflow: visible;
  }

  #tab-video.active,
  #tab-image.active {
    display: block;
    height: auto;
    overflow: visible;
  }

  .workspace-layout {
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .primary-workspace {
    overflow: visible;
  }

  .recent-jobs-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  #tab-video > .video-panel-grid,
  .image-panel-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .image-params-panel,
  .image-preview-panel,
  .image-tasks-panel,
  .video-params-panel,
  .video-preview-panel,
  .video-tasks-panel {
    height: auto;
  }

  .image-preview-panel,
  .video-preview-panel {
    min-height: 520px;
  }

  .video-preview-panel {
    grid-template-rows: auto auto auto minmax(240px, auto);
    overflow: visible;
  }

  .video-preview-panel #videoBox {
    min-height: 240px;
    height: min(52vh, 420px);
  }

  .image-tasks-panel,
  .video-tasks-panel {
    height: min(70vh, 620px);
  }

  .workspace-header,
  .surface-head {
    flex-direction: column;
  }

  .user-pill {
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 680px) {
  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 20px;
  }

  .nav-actions {
    width: 100%;
    display: grid;
    gap: 10px;
  }

  .hero {
    padding-top: 34px;
  }

  .hero-metrics,
  .progress-steps,
  .image-options,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 430px;
  }

  .workspace {
    padding: 18px;
  }

  .image-preview-panel,
  .video-preview-panel {
    min-height: 380px;
  }

  .video-draft-grid {
    grid-template-columns: 1fr;
  }

  .video-modal-grid {
    grid-template-columns: 1fr;
  }

  .video-price-summary {
    grid-template-columns: 1fr;
  }

  .video-draft-grid textarea {
    min-height: 132px;
  }

  .video-preview-panel #videoBox {
    height: min(48vh, 340px);
  }

  .image-tasks-panel,
  .video-tasks-panel {
    height: min(62vh, 520px);
  }

  .upload-zone {
    grid-template-columns: minmax(64px, 104px) 1fr;
  }

  .upload-remove-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .auth-card {
    margin: 24px auto;
  }
}
