:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-border: #e7e9f2;
  --text: #262a35;
  --text-dim: #6b7280;
  --accent: #4f6bff;
  --accent-dark: #3950d6;
  --accent-soft: #eef1ff;
  --danger: #d9483a;
  --success: #2fa365;
  --warn: #b9860f;
  --radius: 16px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 0.6rem;
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.nav { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.nav a { color: var(--text); font-weight: 500; }
.nav a:hover { color: var(--accent); text-decoration: none; }
.user-chip { color: var(--text-dim); font-size: 0.9rem; }

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 2.5rem 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.03);
}
.card.narrow { max-width: 420px; margin: 3rem auto; }
.card.highlight { border-color: var(--accent); background: var(--accent-soft); }
.card.error-card { border-color: var(--danger); background: #fdf1ef; }

h1 { font-size: 1.6rem; margin: 0.2rem 0 1.25rem; font-weight: 700; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.2rem 0 0.5rem; font-weight: 600; }

.subtitle { color: var(--text-dim); font-size: 1rem; margin: -0.75rem 0 1.5rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-dim);
  font-weight: 500;
}
label.checkbox { display: flex; align-items: flex-start; gap: 0.6rem; color: var(--text); font-weight: 400; }
label.checkbox input { width: auto; margin-top: 0.2rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], select, textarea {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: #fbfbfe;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }

/* Large, friendly drag & drop areas */
.drop-zone {
  padding: 1.75rem 1.25rem;
  border: 2px dashed #c7cdf2;
  border-radius: var(--radius);
  background: #fafbff;
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text);
}
.drop-zone.drag-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.drop-zone-copy,
.file-selection { display: block; margin-top: 0.35rem; font-size: 0.88rem; font-weight: 400; }
.drop-zone-copy { color: var(--text-dim); }
.file-selection { color: var(--accent-dark); overflow-wrap: anywhere; }
.drop-zone input[type=file] {
  margin: 0.85rem auto 0;
  max-width: 320px;
  background: #fff;
}

.drop-zone-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.drop-zone-row .drop-zone { flex: 1 1 240px; }
.drop-zone-row .drop-zone.unified { flex-basis: 100%; }
.drop-zone-row .or-divider { align-self: center; color: var(--text-dim); font-size: 0.85rem; font-weight: 600; }
.drop-zone.compact { padding: 1.2rem 1rem; }

.upload-shell { display: flex; flex-direction: column; gap: 1.15rem; }
.upload-hero { text-align: center; padding: 0.8rem 0 0.35rem; }
.upload-hero h1 { margin-bottom: 0.45rem; font-size: 1.9rem; }
.upload-hero > p { color: var(--text-dim); margin: 0 auto 1.25rem; max-width: 620px; }
.eyebrow { display: inline-block; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.78rem; font-weight: 700; margin-bottom: 0.65rem; }
.flow-strip { display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; padding: 0; margin: 0 auto 1.4rem; max-width: 600px; position: relative; }
.flow-strip::before { content: ""; position: absolute; left: 16.67%; right: 16.67%; top: 17px; height: 2px; background: var(--panel-border); z-index: 0; }
.flow-strip li { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; color: var(--text-dim); font-size: 0.85rem; font-weight: 600; position: relative; z-index: 1; }
.flow-strip li span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 2px solid var(--panel-border); color: var(--text-dim); }
.flow-strip li.active span, .flow-strip li.done span { background: var(--accent); border-color: var(--accent); color: #fff; }
.flow-strip li.active, .flow-strip li.done { color: var(--text); }
.simple-upload-form { display: flex; flex-direction: column; gap: 1rem; }
.upload-step-card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius-lg); padding: 1.45rem; }
.upload-step-card.optional-step { background: #fbfbfd; }
.mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.mode-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.65rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.mode-option input { grid-row: 1 / span 2; margin-top: 0.25rem; }
.mode-option strong { font-size: 1rem; }
.mode-option span { color: var(--text-dim); font-size: 0.84rem; line-height: 1.45; }
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.08); }
.step-heading { display: flex; gap: 0.85rem; align-items: flex-start; margin-bottom: 1rem; }
.step-heading h2 { margin: 0; }
.step-heading h2 small { color: var(--text-dim); font-size: 0.76rem; font-weight: 500; }
.step-heading p { color: var(--text-dim); font-size: 0.88rem; margin: 0.15rem 0 0; }
.step-number { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; font-weight: 700; }
.step-number.muted { background: #eef0f6; color: var(--text-dim); }
.submit-panel { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius-lg); padding: 1.35rem; text-align: center; position: sticky; bottom: 0.75rem; box-shadow: 0 10px 30px rgba(34, 42, 79, 0.09); z-index: 4; }
.estimate-line { display: flex; justify-content: center; gap: 0.35rem; flex-wrap: wrap; color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.85rem; }
.estimate-line strong { color: var(--text); }
.submit-panel p { color: var(--text-dim); font-size: 0.82rem; margin: 0.65rem 0 0; }
.progress-card { text-align: center; }
.progress-card h2 { font-size: 1.3rem; }
.result-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }

fieldset { border: 1px solid var(--panel-border); border-radius: var(--radius); margin-bottom: 1.25rem; padding: 1.1rem 1.2rem; }
legend { padding: 0 0.5rem; color: var(--text); font-weight: 600; font-size: 1rem; }
fieldset.highlight { border-color: var(--accent); }
fieldset.plain { border: none; padding: 0; margin: 0 0 1.25rem; }

.optional-section, .advanced-settings, .what-it-does {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  padding: 0.9rem 1.2rem;
  background: #fcfcff;
}
.optional-section summary, .advanced-settings summary, .what-it-does summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.4rem 0;
}
.optional-section[open] summary, .advanced-settings[open] summary, .what-it-does[open] summary { margin-bottom: 0.6rem; }
.optional-section fieldset, .advanced-settings fieldset { margin-bottom: 0.9rem; border: none; padding: 0; }
.optional-section fieldset:last-child, .advanced-settings fieldset:last-child { margin-bottom: 0; }
.what-it-does p, .what-it-does li { color: var(--text-dim); font-size: 0.9rem; }

.button {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}
.button.primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.danger { border-color: var(--danger); color: var(--danger); background: #fff; }
.button.danger:hover { background: #fff1ec; }
.button.large { padding: 0.95rem 1.8rem; font-size: 1.08rem; width: 100%; text-align: center; }
.button.small { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.link-button { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: inherit; font-weight: 500; }

.inline-form { display: inline-flex; gap: 0.4rem; align-items: center; }
.inline-form-block { border-top: 1px solid var(--panel-border); margin-top: 1rem; padding-top: 1rem; }

.flash-stack { margin-bottom: 1.25rem; }
.flash { padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 0.6rem; font-size: 0.92rem; }
.flash-error { background: #fdf1ef; border: 1px solid var(--danger); color: #a83326; }
.flash-success { background: #eefaf3; border: 1px solid var(--success); color: #1f7a4d; }
.flash-info { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent-dark); }

.badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #eef0f6;
  border: 1px solid var(--panel-border);
  color: var(--text);
}
.badge.large { font-size: 1rem; padding: 0.45rem 1rem; }
.badge.status-completed { background: #eafaf1; border-color: var(--success); color: #1f7a4d; }
.badge.status-demo { background: #fff7df; border-color: #d59b1a; color: #855d00; }
.badge.status-failed { background: #fdf1ef; border-color: var(--danger); color: #a83326; }
.badge.status-cancelled { background: #f1f1ed; border-color: #b7b8b1; color: #62645d; }
.badge.status-generating, .badge.status-analyzing, .badge.status-frames_pending { background: #fbf3e2; border-color: var(--warn); color: #8a6208; }

/* Friendly card list for task overview (replaces dense tables) */
.task-list { display: flex; flex-direction: column; gap: 0.9rem; }
.task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}
.task-card-main { min-width: 0; flex: 1 1 320px; }
.task-card-title { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.3rem; overflow-wrap: anywhere; }
.task-card-meta { color: var(--text-dim); font-size: 0.82rem; }
.task-card-actions { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.task-card-actions form { margin: 0; }
.task-progress { flex: 1 0 100%; }
.task-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.45rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.task-progress-head strong { color: var(--text); font-size: 0.88rem; }
.task-progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ecf4;
}
.task-progress-fill {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #7990ff);
  transition: width 0.45s ease;
}
.task-progress-fill.status-completed { background: var(--success); }
.task-progress-fill.status-demo { background: #d59b1a; }
.task-progress-fill.status-failed { background: var(--danger); }
.task-progress-fill.status-cancelled { background: #8a8c84; }
.task-progress-fill.status-generating,
.task-progress-fill.status-analyzing,
.task-progress-fill.status-frames_pending {
  background: linear-gradient(90deg, #f0ac2c, #f7ca65);
}
.legacy-section { margin-top: 1.2rem; }
.legacy-task-list { margin: 0.6rem 0 0; padding-left: 1.25rem; color: var(--text-dim); font-size: 0.88rem; }
.legacy-task-list li { margin: 0.35rem 0; }
.legacy-task-list span { font-size: 0.8rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--panel-border); text-align: left; }
.table th { color: var(--text-dim); font-weight: 600; }

.kv-table td, .kv-table th { padding: 0.4rem 0.6rem; }
.kv-table th { text-align: left; color: var(--text-dim); width: 40%; }

.hint { color: var(--text-dim); font-size: 0.88rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.muted-line { color: var(--text-dim); font-size: 0.82rem; margin: 0.2rem 0 1rem; }

.evidence-list { margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; color: var(--text-dim); font-size: 0.9rem; }
.notice { background: #fbf3e2; border: 1px solid var(--warn); border-radius: 10px; padding: 0.75rem 1rem; margin: 0.7rem 0; font-size: 0.88rem; color: #6b4e08; }
.script-view { white-space: pre-wrap; background: #fbfbfe; padding: 0.9rem; border-radius: 10px; border: 1px solid var(--panel-border); max-height: 24rem; overflow-y: auto; }

.contact-sheet { max-width: 100%; border-radius: 10px; margin: 0.6rem 0; }
.ref-thumb { max-width: 200px; border-radius: 10px; margin: 0.4rem 0; }
.frame-pair { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.frame-preview { max-width: 260px; width: 100%; border-radius: 10px; border: 1px solid var(--panel-border); }
.result-video { width: 100%; max-width: 480px; border-radius: 10px; display: block; margin-bottom: 1rem; }
.result-placeholder {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 560px;
  margin: 0 0 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: #fff;
  color: var(--text-dim);
}
.result-placeholder strong { color: var(--text); }

.shot-row { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.shot-row select { width: auto; }
.shot-row input[type=text] { width: 12rem; }

.download-list { padding-left: 1.2rem; }
.event-list { list-style: none; padding: 0; font-size: 0.85rem; color: var(--text-dim); max-height: 20rem; overflow-y: auto; }
.event-list li { padding: 0.3rem 0; border-bottom: 1px dashed var(--panel-border); }

.admin-nav { display: flex; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

.stat-grid { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.stat-card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 1.1rem 1.5rem; text-align: center; min-width: 8rem; }
.stat-num { display: block; font-size: 1.7rem; font-weight: 700; }

.ops { display: flex; flex-direction: column; gap: 0.4rem; }
.credit-neg { color: var(--danger); }
.credit-pos { color: var(--success); }

.recharge-card { max-width: 560px; }
.quick-amounts { display: flex; gap: 0.55rem; flex-wrap: wrap; margin: -0.45rem 0 1.1rem; }
.amount-chip {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.amount-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.recharge-note { margin: 1rem 0 0; text-align: center; }
.recharge-needed {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--warn);
}
.recharge-needed span { color: var(--text-dim); flex: 1 1 240px; }

@media (max-width: 640px) {
  .container { padding: 1rem 0.9rem 3rem; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0.9rem 1rem; }
  .card { padding: 1.25rem; }
  .drop-zone-row { flex-direction: column; }
  .task-card { flex-direction: column; align-items: flex-start; }
  .task-card-actions { width: 100%; }
  .task-card-actions .button { flex: 1; }
  .upload-hero h1 { font-size: 1.55rem; }
  .upload-step-card { padding: 1rem; }
  .mode-options { grid-template-columns: 1fr; }
  .submit-panel { padding: 1rem; position: static; }
  .flow-strip li { font-size: 0.75rem; }
  .result-actions { flex-direction: column; }
  .result-actions .button { text-align: center; }
}

/* --------------------------------------------------------------------------
   2026 card-dashboard visual system
   Inspired by the supplied modular UI reference: warm canvas, charcoal pills,
   soft yellow focus states, large rounded cards and compact dashboard spacing.
   -------------------------------------------------------------------------- */
:root {
  --bg: #aeb3bf;
  --panel: rgba(255, 255, 252, 0.88);
  --panel-solid: #fffefa;
  --panel-border: rgba(42, 43, 40, 0.12);
  --text: #262724;
  --text-dim: #74766f;
  --accent: #f5c94c;
  --accent-dark: #2c2d2a;
  --accent-soft: #fff2b8;
  --danger: #d95e4b;
  --success: #4a8b65;
  --warn: #b17d16;
  --radius: 20px;
  --radius-lg: 28px;
  --shadow: 0 24px 70px rgba(41, 43, 47, 0.16);
}

html { min-height: 100%; }
body {
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,.18), transparent 34%),
    #aeb3bf;
  font-family: "Avenir Next", "SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  letter-spacing: -0.012em;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 30px;
  background:
    radial-gradient(circle at 88% 15%, rgba(255, 228, 105, 0.52), transparent 27%),
    radial-gradient(circle at 18% 88%, rgba(244, 205, 73, 0.22), transparent 30%),
    linear-gradient(135deg, #f6f6f1 0%, #f8f7ed 55%, #fff3b8 100%);
  box-shadow: var(--shadow);
}

.topbar {
  position: relative;
  top: auto;
  min-height: 82px;
  padding: 18px 24px;
  border: 0;
  background: transparent;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--text);
  border-radius: 50%;
  background: rgba(255,255,255,.58);
  font-size: .86rem;
  font-weight: 800;
}

.nav {
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(40, 41, 38, 0.08);
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(14px);
}
.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: #666861;
  font-size: .82rem;
  font-weight: 600;
}
.nav a.active,
.nav a:hover {
  color: #fff;
  background: var(--accent-dark);
  text-decoration: none;
}
.user-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-left: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #5f511c;
  font-size: .73rem;
}
.user-chip strong { color: var(--text); font-size: .88rem; }
.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--panel-solid);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}

.container {
  width: 100%;
  max-width: none;
  padding: 26px 28px 44px;
}
.footer { padding: 18px 28px 26px; color: #7c7d75; }

h1 {
  max-width: 780px;
  margin: 0 0 14px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.055em;
}
h2 { font-size: 1.04rem; letter-spacing: -.025em; }
h3 { letter-spacing: -.02em; }
.subtitle { margin: 0; }
.page-head { align-items: center; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(2rem, 3vw, 2.8rem); }

.card,
.upload-step-card,
.task-card,
.optional-section,
.advanced-settings,
.what-it-does,
.stat-card {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(56, 57, 52, .045);
  backdrop-filter: blur(12px);
}
.card { padding: 24px; margin-bottom: 16px; border-radius: var(--radius-lg); }
.card.highlight {
  border-color: rgba(42,43,40,.16);
  background: var(--panel-solid);
}
.card.error-card { background: #fff1ec; }

.button {
  padding: 10px 18px;
  border-color: rgba(42,43,40,.16);
  background: rgba(255,255,255,.75);
  font-size: .9rem;
  font-weight: 650;
}
.button:hover { text-decoration: none; background: #fff; }
.button.primary {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}
.button.primary:hover { background: #11120f; }
.button.large { padding: 15px 22px; font-size: 1rem; }
.link-button { color: var(--text); }

.upload-shell { gap: 22px; }
.upload-hero {
  position: relative;
  min-height: 180px;
  padding: 20px 2px 14px;
  text-align: left;
}
.upload-hero h1 { margin-bottom: 14px; font-size: clamp(2.3rem, 5vw, 4.4rem); }
.upload-hero > p { max-width: 680px; margin: 0 0 8px; color: #6d6f68; }
.eyebrow {
  margin-bottom: 18px;
  padding: 6px 11px;
  border: 1px solid rgba(42,43,40,.14);
  background: rgba(255,255,255,.58);
  color: var(--text);
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.flow-strip {
  position: absolute;
  right: 0;
  bottom: 18px;
  width: 330px;
  margin: 0;
}
.flow-strip::before { background: rgba(44,45,42,.12); }
.flow-strip li { color: #777970; font-size: .72rem; }
.flow-strip li span {
  width: 31px;
  height: 31px;
  border-color: rgba(44,45,42,.12);
  background: #f8f7ef;
}
.flow-strip li.active span,
.flow-strip li.done span { border-color: var(--accent-dark); background: var(--accent-dark); }

.simple-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr);
  gap: 14px;
}
.upload-step-card {
  min-width: 0;
  padding: 22px;
  border-radius: var(--radius-lg);
}
.simple-upload-form > .upload-step-card:first-of-type,
.simple-upload-form > .advanced-settings,
.simple-upload-form > .submit-panel { grid-column: 1 / -1; }
.mode-card { grid-column: 1; }
#face-options,
#background-options { grid-column: 2; }
.step-heading { gap: 12px; margin-bottom: 18px; }
.step-number {
  width: 31px;
  height: 31px;
  flex-basis: 31px;
  border-radius: 10px;
  background: var(--accent-dark);
  font-size: .78rem;
}
.step-heading p { font-size: .8rem; }

.drop-zone-row { align-items: stretch; }
.drop-zone {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1.5px dashed rgba(44,45,42,.24);
  border-radius: 20px;
  background: rgba(249,248,239,.74);
  font-size: .94rem;
}
.drop-zone:hover,
.drop-zone.drag-active {
  border-color: var(--accent-dark);
  background: #fff8d2;
  transform: translateY(-2px);
}
.drop-zone.compact { min-height: 150px; }
.drop-zone input[type=file] {
  max-width: 350px;
  padding: 8px;
  border: 0;
  background: transparent;
  font-size: .78rem;
}
.drop-zone-row .or-divider {
  display: grid;
  place-items: center;
  width: 28px;
  font-size: .68rem;
}

.mode-options { grid-template-columns: 1fr; gap: 8px; }
.mode-option {
  padding: 13px 14px;
  border-radius: 17px;
  background: rgba(255,255,255,.62);
}
.mode-option:has(input:checked) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
  box-shadow: none;
}
.mode-option:has(input:checked) span { color: #c8c9c3; }
.mode-option input { accent-color: var(--accent); }
.audio-mode-block { margin-top: 18px; }
.audio-mode-title { margin: 0 0 8px; font-weight: 700; }
.audio-mode-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.analysis-model-note { margin: 9px 2px 0; color: var(--text-dim); font-size: .76rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], select, textarea {
  padding: 11px 13px;
  border-color: rgba(44,45,42,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 4px rgba(245,201,76,.28);
}

.submit-panel {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  align-items: center;
  gap: 8px 22px;
  position: static;
  padding: 18px 20px;
  border-radius: 22px;
  background: var(--accent-soft);
  box-shadow: none;
  text-align: left;
}
.submit-panel .estimate-line { justify-content: flex-start; margin: 0; }
.submit-panel .button { grid-column: 2; grid-row: 1 / span 2; }
.submit-panel p,
.submit-panel > .hint { margin: 0; }
.credit-warning,
.task-credit-alert,
.task-issue {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid #d95745;
  border-radius: 14px;
  background: #fff0ec;
  color: #9e3025;
  font-size: .82rem;
}
.credit-warning[hidden],
.task-credit-alert[hidden],
.task-issue[hidden] { display: none; }
.credit-warning a,
.task-credit-alert a { color: inherit; font-weight: 700; }
.submit-panel .credit-warning { grid-column: 1; }
.task-credit-alert,
.task-issue { flex: 1 0 100%; }
.task-issue { border-color: #d95745; background: #fff0ec; color: #8e2d24; }
.task-issue span { line-height: 1.5; }

.task-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.task-card {
  align-content: space-between;
  min-height: 190px;
  padding: 20px;
  border-radius: 24px;
}
.task-card-video-wrap {
  position: relative;
  flex: 1 0 100%;
  overflow: hidden;
  border-radius: 18px;
  background: #171815;
  aspect-ratio: 16 / 9;
}
.task-card-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #171815;
}
.task-card-generating {
  display: grid;
  place-items: center;
  min-height: 190px;
  color: #fff;
}
.generating-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(125deg, #20211f 12%, #343530 48%, #20211f 84%);
}
.generating-visual::after {
  content: "";
  position: absolute;
  inset: -40% -70%;
  background: linear-gradient(100deg, transparent 42%, rgba(255,226,112,.2) 50%, transparent 58%);
  animation: generating-sweep 1.7s linear infinite;
}
.generating-visual span {
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  animation: generating-pulse 1.7s ease-in-out infinite;
}
.generating-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}
.generating-copy strong { font-size: 1.05rem; }
.generating-copy span { color: #d6d7d1; font-size: .78rem; }
.generating-copy [data-generating-percent] { color: var(--accent); font-weight: 800; font-size: 1rem; }
@keyframes generating-sweep { to { transform: translateX(42%); } }
@keyframes generating-pulse { 50% { transform: scale(.88); opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .generating-visual::after, .generating-visual span { animation: none; }
}
.task-video-label {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(249,248,239,.9);
  color: var(--text);
  font-size: .7rem;
  font-weight: 700;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.task-card:nth-child(3n + 1) { background: rgba(255,255,252,.86); }
.task-card:nth-child(3n + 2) { background: rgba(255,244,184,.8); }
.task-card:nth-child(3n) { background: rgba(48,49,46,.94); color: #fff; }
.task-card:nth-child(3n) .task-card-meta,
.task-card:nth-child(3n) .task-progress-head,
.task-card:nth-child(3n) .task-progress-head strong { color: #c6c7c1; }
.task-card-title { font-size: 1.22rem; font-weight: 600; }
.task-progress-track { height: 7px; background: rgba(140,141,135,.2); }
.task-progress-fill { background: var(--accent-dark); }
.task-progress-fill.status-completed { background: var(--accent); }

.badge { border: 0; background: #e8e8e2; font-size: .73rem; }
.badge.status-completed { background: #dff3e6; color: #286341; }
.badge.status-generating,
.badge.status-analyzing,
.badge.status-frames_pending { background: #ffe789; color: #67500a; }
.task-card:nth-child(3n) .badge { background: rgba(255,255,255,.14); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); }
.stat-card { min-width: 0; border-radius: 22px; text-align: left; }
.stat-card:nth-child(2n) { background: var(--accent-soft); }
.stat-num { font-size: 2.2rem; font-weight: 500; }
.admin-nav {
  gap: 5px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
}
.admin-nav a { padding: 7px 12px; border-radius: 999px; color: var(--text); font-size: .8rem; }
.admin-nav a:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }

.result-video { max-width: 440px; border-radius: 20px; background: #171815; }
.script-view { border-radius: 16px; background: #f5f4ec; }
.contact-sheet, .frame-preview { border-radius: 18px; }
.notice { border: 0; border-radius: 16px; background: #fff0ad; }
.flash { border-radius: 14px; }

@media (max-width: 900px) {
  body { padding: 14px; }
  .app-shell { min-height: calc(100vh - 28px); }
  .topbar { align-items: flex-start; }
  .nav { border-radius: 22px; }
  .container { padding: 20px; }
  .flow-strip { position: relative; right: auto; bottom: auto; width: 100%; margin-top: 22px; }
  .upload-hero { min-height: 0; }
  .simple-upload-form { grid-template-columns: 1fr; }
  .simple-upload-form > *, .mode-card, #face-options, #background-options { grid-column: 1 !important; }
  .audio-mode-options { grid-template-columns: 1fr; }
  .task-list { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 640px) {
  body { padding: 0; background: #f5f4ec; }
  .app-shell { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding: 14px 16px; }
  .brand span:last-child { display: none; }
  .nav { width: calc(100% - 50px); overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; }
  .nav a { white-space: nowrap; padding: 7px 11px; }
  .user-chip span { display: none; }
  .container { padding: 18px 14px 34px; }
  .upload-hero h1 { font-size: 2.35rem; }
  .upload-step-card { padding: 17px; }
  .drop-zone-row .or-divider { width: 100%; height: 18px; }
  .submit-panel { grid-template-columns: 1fr; }
  .submit-panel .button { grid-column: 1; grid-row: auto; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* Treat the whole upload card as the file picker; remove the browser's native row. */
.drop-zone { position: relative; overflow: hidden; }
.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

@media (min-width: 761px) and (max-width: 900px) {
  .simple-upload-form { grid-template-columns: minmax(0, 1fr) minmax(300px, .78fr); }
  .simple-upload-form > .upload-step-card:first-of-type,
  .simple-upload-form > .advanced-settings,
  .simple-upload-form > .submit-panel { grid-column: 1 / -1 !important; }
  .mode-card { grid-column: 1 !important; }
  #face-options, #background-options { grid-column: 2 !important; }
}
@media (min-width: 761px) and (max-width: 900px) {
  .task-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
