:root {
  color-scheme: dark;
  --bg: #07090b;
  --panel: #181b1f;
  --panel-2: #20242a;
  --line: #343b45;
  --text: #f2f4f7;
  --muted: #a9b0ba;
  --accent: #43d6a6;
  --accent-2: #f2b84b;
  --danger: #ff6f7d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(67, 214, 166, 0.035), transparent 38%),
    radial-gradient(circle at 85% 0%, rgba(242, 184, 75, 0.045), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.home-view {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 56px;
  align-items: center;
  min-height: 100vh;
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto;
  padding: 54px 0;
  position: relative;
  overflow: hidden;
}

.home-view::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle at 88% 8%, rgba(67, 214, 166, 0.18), transparent 26%),
    radial-gradient(circle at 8% 62%, rgba(67, 214, 166, 0.075), transparent 34%),
    linear-gradient(115deg, #030706 0%, #080b0f 50%, #030407 100%);
}

.home-rings {
  position: absolute;
  left: -300px;
  bottom: 80px;
  z-index: -1;
  width: 820px;
  height: 820px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 22px, rgba(67, 214, 166, 0.09) 23px 24px);
  opacity: 0.28;
  transform: rotate(-20deg);
  mask-image: linear-gradient(90deg, #000, transparent 76%);
}

.home-copy h1 {
  max-width: 720px;
  margin: 22px 0 22px;
  font-size: clamp(44px, 5.2vw, 78px);
  line-height: 0.98;
  position: relative;
  text-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.home-copy h1 span {
  color: #ffffff;
  text-shadow: 0 0 34px rgba(67, 214, 166, 0.12);
}

.home-copy h1 em {
  color: var(--accent);
  font-style: normal;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 52px;
  color: var(--text);
  font-size: 23px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-brand b {
  padding: 2px 8px;
  border-radius: 7px;
  background: var(--accent);
  color: #092117;
  font-size: 14px;
}

.brand-icon {
  display: inline-block;
  width: 28px;
  height: 28px;
  clip-path: polygon(18% 0, 100% 50%, 18% 100%, 0 82%, 48% 50%, 0 18%);
  background: linear-gradient(135deg, #7dffc9, #10bc80);
  box-shadow: 0 0 24px rgba(67, 214, 166, 0.5);
}

.home-pill {
  display: inline-flex;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid rgba(67, 214, 166, 0.22);
  border-radius: 999px;
  background: rgba(67, 214, 166, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-text {
  max-width: 720px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.55;
}

.home-text strong {
  color: var(--text);
  font-weight: 850;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 34px;
  max-width: 680px;
}

.home-features div {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 3px 14px;
  align-items: center;
}

.home-features i {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(67, 214, 166, 0.1);
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
}

.home-features strong {
  font-size: 14px;
}

.home-features span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.card-label {
  display: inline-flex;
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
}

.login-card {
  align-self: center;
  display: grid;
  gap: 22px;
  padding: 34px;
  border: 1px solid rgba(67, 214, 166, 0.34);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(24, 30, 33, 0.78), rgba(15, 18, 22, 0.9));
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.login-head {
  display: flex;
  align-items: center;
  gap: 20px;
}

.login-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(67, 214, 166, 0.3), rgba(67, 214, 166, 0.06));
  color: var(--accent);
  font-size: 28px;
}

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

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 22px;
}

.home-button,
.secondary {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.account-box {
  display: grid;
  gap: 2px;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.9);
  text-align: right;
}

.account-box span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  line-height: 0.95;
  letter-spacing: 0;
}

.status {
  min-width: 152px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.82);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status.ok {
  color: var(--accent);
}

.status.bad {
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(430px, 0.9fr) minmax(520px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.95);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121417;
}

.mode {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.mode.active {
  background: var(--accent);
  color: #071410;
}

.mode.has-active {
  position: relative;
  padding-right: 28px;
}

.mode.has-active::after {
  content: attr(data-active-count);
  position: absolute;
  top: 6px;
  right: 7px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.mode.has-active::before {
  content: "";
  position: absolute;
  top: 11px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: pulse 1.1s ease-in-out infinite;
}

.field,
.drop {
  display: grid;
  gap: 7px;
}

.field span,
.drop span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

textarea {
  resize: vertical;
  min-height: 92px;
  padding: 13px;
  line-height: 1.45;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
}

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

.reference-only {
  display: grid;
  gap: 12px;
}

.reference-only .media-grid {
  grid-template-columns: 1fr;
}

.drop {
  min-height: 108px;
  padding: 14px;
  border: 1px dashed #4b5562;
  border-radius: 8px;
  background: #111418;
}

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

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #071410 !important;
  cursor: pointer;
  font-size: 13px !important;
  font-weight: 850 !important;
}

.drop.dragging {
  border-color: var(--accent);
  background: rgba(67, 214, 166, 0.1);
}

.drop.has-file {
  border-color: rgba(67, 214, 166, 0.76);
}

.drop small {
  color: var(--muted);
  line-height: 1.35;
}

.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-chip {
  display: grid;
  grid-template-columns: 54px minmax(80px, 1fr);
  gap: 6px;
  align-items: center;
  width: min(100%, 220px);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1215;
}

.preview-chip img,
.file-kind {
  width: 54px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: #070809;
}

.file-kind {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
}

.preview-chip span {
  color: var(--text);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-token {
  display: inline-block;
  margin-right: 5px;
  color: var(--accent);
  font-weight: 900;
}

.preview-chip button {
  grid-column: 2;
  width: fit-content;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #101215;
  font-weight: 700;
}

.toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-2);
  color: #171106;
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
}

.submit:disabled {
  cursor: wait;
  opacity: 0.62;
}

.arrow {
  font-size: 22px;
}

.preview-panel {
  overflow: hidden;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 520px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    #0c0d0f;
  background-size: 28px 28px;
}

.preview-stage video {
  width: 100%;
  max-height: 72vh;
  background: #000;
}

.empty,
.working {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.empty strong,
.working strong {
  color: var(--text);
  font-size: 20px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.global-working {
  max-width: 460px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

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

.result-meta strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.download {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #071410;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.logs {
  min-height: 160px;
  max-height: 260px;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: #101215;
  color: #cbd2dc;
  white-space: pre-wrap;
}

.job-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.history-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.95);
  box-shadow: var(--shadow);
}

.history-panel > summary {
  cursor: pointer;
  padding: 14px 18px;
  color: var(--text);
  font-weight: 900;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding: 0 18px 18px;
}

.history-summary {
  color: var(--muted);
  font-size: 12px;
}

.history-day {
  display: grid;
  gap: 10px;
}

.history-day h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 8px 0;
  background: rgb(24, 27, 31);
  color: var(--text);
  font-size: 13px;
}

.history-day h3 span {
  color: var(--muted);
  font-size: 12px;
}

.history-item,
.history-empty {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.history-item {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 12px;
}

.history-video-button,
.history-video-empty {
  display: block;
  width: 160px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.history-video-button {
  cursor: pointer;
}

.history-video-button video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 120px;
  object-fit: contain;
  background: #000;
}

.history-video-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  color: var(--muted);
  font-size: 12px;
}

.history-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.history-main strong,
.history-main span,
.history-main small,
.history-main p {
  overflow-wrap: anywhere;
}

.history-main strong {
  color: var(--text);
  font-size: 13px;
}

.history-main span,
.history-main small,
.history-status {
  color: var(--muted);
  font-size: 12px;
}

.history-main p {
  margin: 0;
  color: rgba(242, 244, 247, 0.88);
  font-size: 13px;
  line-height: 1.45;
}

.input-media-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.input-media-card,
.input-media-error {
  display: grid;
  gap: 5px;
  width: 126px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1215;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}

.input-media-card img,
.input-media-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: contain;
  background: #000;
}

.input-media-card audio {
  width: 100%;
  height: 32px;
}

.input-media-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-media-error {
  width: min(100%, 320px);
  color: var(--danger);
}

.history-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 128px;
}

.history-item a,
.history-actions button {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.history-actions button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.history-actions .remake-history {
  width: 128px;
  min-height: 46px;
  border-color: rgba(67, 214, 166, 0.72);
  background: var(--accent);
  color: #071410;
  font-size: 15px;
}

.history-actions .frame-edit-history {
  width: 128px;
  min-height: 46px;
  border-color: rgba(242, 184, 75, 0.76);
  background: #f2b84b;
  color: #171106;
  font-size: 13px;
}

.history-actions button[data-delete-history] {
  color: var(--danger);
}

.history-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
}

.video-edit-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.95);
  box-shadow: var(--shadow);
}

.video-edit-panel video {
  width: 100%;
  max-height: 520px;
  border-radius: 8px;
  background: #000;
}

.video-edit-drop {
  margin: 0;
}

.video-edit-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.video-edit-controls .status-box,
.video-edit-controls .submit {
  grid-column: span 2;
}

.video-edit-timeline,
.video-edit-gallery {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.62);
}

.timeline-viewport {
  position: relative;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 54px 0 30px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.timeline-track {
  position: relative;
  min-height: 94px;
}

.thumb-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--thumb-width, 8px);
  gap: var(--thumb-gap, 1px);
  padding: 0 0 8px;
}

.thumb {
  position: relative;
  min-height: 58px;
  padding: 0;
  border: 1px solid rgba(116, 132, 152, 0.38);
  border-radius: 2px;
  overflow: hidden;
  background: #080a0c;
  cursor: pointer;
}

.thumb.active {
  border-color: #43d6a6;
  box-shadow: inset 0 0 0 2px rgba(67, 214, 166, 0.34);
}

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

.thumb span {
  position: absolute;
  left: 0;
  bottom: -22px;
  min-width: 34px;
  padding: 1px 3px;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 4px;
  color: var(--text);
  font-size: 10px;
  transform: translateX(-1px);
}

.thumb:not(.second-mark) span {
  display: none;
}

.thumb.second-mark {
  overflow: visible;
  border-color: rgba(190, 200, 214, 0.68);
}

.thumb.second-mark::before {
  content: "";
  position: absolute;
  left: 0;
  top: -8px;
  width: 1px;
  height: 8px;
  background: rgba(220, 228, 238, 0.78);
}

.selection-band {
  position: absolute;
  top: 0;
  bottom: 8px;
  z-index: 1;
  background: rgba(67, 214, 166, 0.18);
  border-left: 2px solid #43d6a6;
  border-right: 2px solid #43d6a6;
  pointer-events: none;
}

.timeline-handle {
  position: absolute;
  top: -46px;
  z-index: 4;
  width: 82px;
  min-height: 38px;
  transform: translateX(-50%);
  display: grid;
  gap: 1px;
  place-items: center;
  border: 1px solid #d8f6e3;
  background: #43d6a6;
  color: #06100a;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  touch-action: none;
}

.timeline-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 72px;
  background: #d8f6e3;
  transform: translateX(-50%);
}

.timeline-handle.end {
  background: #f2b84b;
  border-color: #fff2b8;
}

.timeline-handle.end::after {
  background: #fff2b8;
}

.timeline-handle strong {
  font-size: 11px;
  line-height: 1;
}

.timeline-handle span {
  font-size: 12px;
  line-height: 1;
}

.result-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.result-card video {
  max-height: 220px;
}

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

.result-actions .small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.result-actions .remake {
  background: #395269;
}

.result-actions .download {
  background: #43d6a6;
  color: #06100a;
}

.status-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101215;
  display: grid;
  gap: 5px;
}

.status-box span,
.status-box em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.status-box strong {
  color: var(--text);
  font-size: 24px;
}

.job-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.job-group > summary {
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.job-group > summary span {
  color: var(--muted);
}

.job-group-list {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.job-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.job-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.job-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.job-click {
  cursor: pointer;
}

.job-click:hover strong {
  color: var(--accent);
}

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

.job-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.job-item a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.job-item button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.admin-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.95);
  box-shadow: var(--shadow);
}

.admin-panel > summary {
  cursor: pointer;
  padding: 14px 18px;
  color: var(--text);
  font-weight: 900;
}

.admin-content {
  display: grid;
  gap: 16px;
  padding: 0 18px 18px;
}

.admin-head,
.admin-form,
.admin-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.admin-head h2,
.admin-panel h3 {
  margin: 0;
}

.admin-form {
  align-items: end;
  justify-content: start;
}

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

.admin-grid details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.admin-grid summary {
  cursor: pointer;
  padding: 12px;
  color: var(--text);
  font-weight: 850;
}

.admin-grid details .admin-list {
  padding: 0 12px 12px;
}

.admin-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.admin-overview {
  display: grid;
  gap: 14px;
  padding: 0 12px 12px;
}

.metric-grid,
.chart-grid {
  display: grid;
  gap: 12px;
}

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

.metric-grid div,
.chart-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1215;
  padding: 12px;
}

.metric-grid strong {
  display: block;
  font-size: 22px;
}

.metric-grid span,
.chart-empty {
  color: var(--muted);
  font-size: 12px;
}

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

.chart-grid h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) minmax(120px, 2fr) 44px;
  gap: 8px;
  align-items: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
}

.bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row b {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #07090b;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), rgba(242, 184, 75, 0.9));
}

.admin-row {
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111418;
}

.admin-row strong,
.admin-row span,
.admin-row small {
  overflow-wrap: anywhere;
}

.admin-row span,
.admin-row small {
  color: var(--muted);
  font-size: 12px;
}

.ledger-row {
  display: grid;
  justify-content: stretch;
}

.admin-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  max-height: 620px;
  overflow: auto;
  padding: 0 12px 12px;
}

.gallery-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1215;
}

.gallery-card video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 360px;
  background: #000;
  object-fit: contain;
}

.gallery-meta {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.gallery-meta strong,
.gallery-meta span,
.gallery-meta small {
  overflow-wrap: anywhere;
}

.gallery-meta span,
.gallery-meta small {
  color: var(--muted);
  font-size: 12px;
}

.gallery-card a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0 10px 10px;
  border: 1px solid rgba(67, 214, 166, 0.35);
  border-radius: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 880px) {
  .metric-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }
}

.account-box .version {
  display: block;
  justify-self: end;
  color: rgba(242, 244, 247, 0.78);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 2px;
}

.hidden {
  display: none !important;
}

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

@keyframes pulse {
  50% {
    transform: scale(1.7);
    opacity: 0;
  }
}


@media (max-width: 980px) {
  .home-view,
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 380px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1440px);
    padding-top: 16px;
  }

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

  .mode-tabs,
  .media-grid,
  .settings {
    grid-template-columns: 1fr;
  }

  .result-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-grid,
  .admin-form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Form section label (Reference to Video header) ─── */
.form-section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #666;
  padding-bottom: .5rem;
  border-bottom: 1px solid #222;
  margin-bottom: .25rem;
}

/* ── Plan Sheet ──────────────────────────────────────── */
.plansheet-panel {
  border-top: 1px solid #2a2a2a;
}
.plansheet-panel > summary {
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #e0e0e0;
}
.plansheet-panel > summary::-webkit-details-marker { display: none; }
.plansheet-panel > summary::before {
  content: "▶";
  font-size: .7rem;
  color: #888;
  transition: transform .2s;
}
.plansheet-panel[open] > summary::before { transform: rotate(90deg); }

.plansheet-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.plansheet-head .eyebrow {
  font-size: .75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 .25rem;
}
.plansheet-head h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #f0f0f0;
}
.plansheet-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.plansheet-status {
  font-size: .82rem;
  font-family: monospace;
  color: #aaa;
  min-height: 1.4em;
  white-space: pre-wrap;
}

/* Drop zone */
.plansheet-drop {
  border: 2px dashed #333;
  border-radius: 10px;
  background: #0e0e0e;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, background .2s;
}
.plansheet-drop.dragging {
  border-color: #666;
  background: #181818;
}
.plansheet-drop input[type="file"] {
  display: none;
}
.plansheet-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.plansheet-drop-inner.hidden { display: none; }
.plansheet-drop-icon { font-size: 2.5rem; line-height: 1; }
.plansheet-drop-inner strong { font-size: 1rem; color: #e0e0e0; }
.plansheet-drop-inner small  { font-size: .75rem; color: #555; }
.plansheet-file-btn {
  display: inline-block;
  margin-top: .1rem;
  padding: .3rem .9rem;
  border: 1px solid #444;
  border-radius: 5px;
  font-size: .8rem;
  color: #bbb;
  cursor: pointer;
  background: #1a1a1a;
  transition: border-color .15s, color .15s;
}
.plansheet-file-btn:hover { border-color: #777; color: #fff; }
.plansheet-img-preview {
  position: relative;
}
.plansheet-img-preview.hidden { display: none; }
.plansheet-img-preview img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #000;
}
.plansheet-clear {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #555;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}
.plansheet-clear:hover { background: rgba(0,0,0,.9); border-color: #aaa; }
.plansheet-result {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.plansheet-cuts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.plansheet-cut-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.plansheet-cut-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
}
.plansheet-cut-empty {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: .8rem;
}
.plansheet-cut-meta {
  padding: .6rem .75rem;
}
.plansheet-cut-meta strong {
  font-size: .8rem;
  color: #ccc;
  display: block;
  margin-bottom: .25rem;
}
.plansheet-cut-meta p {
  font-size: .8rem;
  color: #888;
  margin: 0;
  line-height: 1.4;
}
.plansheet-prompt-preview textarea {
  font-size: .85rem;
  color: #bbb;
  background: #111;
  resize: vertical;
}
/* ── Workspace Tabs ──────────────────────────────────── */
.workspace-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.workspace-tab {
  position: relative;
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
  white-space: nowrap;
}

.workspace-tab:hover {
  color: var(--text);
}

.workspace-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Plan Sheet Tab Panel ────────────────────────────── */
.plansheet-tab-panel {
  padding: 24px;
}

.plansheet-columns {
  display: grid;
  grid-template-columns: 400px 760px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .plansheet-columns {
    grid-template-columns: 1fr;
  }
  .gal-col { display: none; }
}

.plansheet-input-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plansheet-result-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plansheet-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.plansheet-result-head strong {
  font-size: 1rem;
  color: var(--text);
}

/* ── Plan Sheet Grid Image ───────────────────────────── */
.plansheet-grid-image {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
}
.plansheet-grid-image img {
  width: 100%;
  height: auto;
  display: block;
}
.ps-img-drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.ps-img-drop-zone:hover .ps-img-drop-overlay,
.ps-img-drop-zone.ps-drag-over .ps-img-drop-overlay {
  opacity: 1;
}
.ps-img-drop-zone.ps-drag-over {
  outline: 2px dashed var(--accent, #7c6fe0);
}
.bq-card-img-wrap.bq-drag-over {
  outline: 2px dashed var(--accent, #7c6fe0);
  border-radius: 8px;
}

.plansheet-scene-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.plansheet-scene-row {
  display: flex;
  gap: 10px;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--muted);
}

.plansheet-scene-num {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--accent);
  min-width: 52px;
}

/* ── Plan Sheet Loading Box ──────────────────────────── */
.plansheet-loading {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 24px 20px;
  box-shadow: 0 0 28px rgba(67, 214, 166, 0.15);
  animation: loading-pulse-border 2s ease-in-out infinite;
}

.plansheet-loading.hidden { display: none; }

@keyframes loading-pulse-border {
  0%, 100% { box-shadow: 0 0 18px rgba(67, 214, 166, 0.12); border-color: rgba(67, 214, 166, 0.5); }
  50%       { box-shadow: 0 0 36px rgba(67, 214, 166, 0.35); border-color: var(--accent); }
}

.plansheet-loading-spinner {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
}

.plansheet-loading-spinner svg {
  width: 56px;
  height: 56px;
  animation: spin 1s linear infinite;
}

.plansheet-loading-spinner svg circle {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 80 40;
  animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
  0%   { stroke-dasharray: 1 110; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 90 10; stroke-dashoffset: -30; }
  100% { stroke-dasharray: 1 110; stroke-dashoffset: -110; }
}

.plansheet-loading-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plansheet-loading-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plansheet-cancel-btn {
  flex-shrink: 0;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: .02em;
  transition: border-color .15s, color .15s;
}

.plansheet-cancel-btn:hover {
  border-color: var(--danger, #e05);
  color: var(--danger, #e05);
}

.plansheet-loading-step {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  letter-spacing: .01em;
}

.plansheet-loading-detail {
  font-size: .82rem;
  font-family: monospace;
  color: var(--muted);
  margin: 0;
  min-height: 1.3em;
}

.submit.loading {
  opacity: .75;
  animation: btn-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btn-pulse {
  0%, 100% { opacity: .75; }
  50%       { opacity: 1; }
}

/* ── Plan Sheet Progress ─────────────────────────────── */
.plansheet-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plansheet-progress.hidden { display: none; }

.plansheet-progress-track {
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.plansheet-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #2fc4a0);
  border-radius: 99px;
  transition: width .4s ease;
  animation: progress-shimmer 1.5s linear infinite;
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--accent) 0%, #7ef5d3 50%, var(--accent) 100%);
}

@keyframes progress-shimmer {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.plansheet-progress span {
  font-size: .78rem;
  color: var(--muted);
}


/* Plansheet thumb list */
.plansheet-thumb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
  max-height: 480px;
  overflow-y: auto;
}

.plansheet-thumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color .15s;
}
.plansheet-thumb-item:hover { border-color: var(--accent); }

.pts-sheet-preview {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.pts-sheet-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plansheet-thumb-num {
  position: absolute;
  top: 2px;
  left: 3px;
  background: rgba(0,0,0,.7);
  color: var(--accent);
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
}

.pts-ref-slots {
  display: flex;
  gap: 8px;
  flex: 1;
}
.pts-ref-slot {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.pts-ref-drop {
  width: 80px;
  height: 80px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: border-color .15s, transform .1s;
  overflow: hidden;
}
.pts-ref-drop:hover { border-color: var(--accent); }
.pts-ref-drop.has-image {
  border: 2px solid var(--accent);
  cursor: zoom-in;
}
.pts-ref-drop.has-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(124,111,224,.4);
}
.pts-ref-drop.pts-drag-over {
  border-color: var(--accent);
  border-style: solid;
  background-color: rgba(124,111,224,.12);
  transform: scale(1.04);
  transition: transform .1s, border-color .1s;
}
.pts-ref-label {
  font-size: .62rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
}
.pts-ref-clear {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: #e05;
  color: #fff;
  font-size: .55rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
}
.pts-ref-clear.hidden { display: none; }

/* ── Text Prompts 프롬프트별 Face/Outfit 슬롯 ── */
.ps-prompt-ref-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 4px;
}
.ps-pref-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.ps-pref-num {
  font-size: .7rem;
  color: var(--muted);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  font-weight: 600;
}
.ps-pref-slot {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.ps-pref-drop {
  width: 72px;
  height: 72px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: border-color .15s, transform .1s;
  overflow: hidden;
}
.ps-pref-drop:hover { border-color: var(--accent); }
.ps-pref-drop.has-image {
  border: 2px solid var(--accent);
  cursor: zoom-in;
}
.ps-pref-drop.has-image:hover {
  transform: scale(1.04);
  box-shadow: 0 3px 10px rgba(124,111,224,.35);
}
.ps-pref-drop.pts-drag-over {
  border: 2px solid var(--accent);
  transform: scale(1.03);
  background-color: rgba(124,111,224,.08);
}
.ps-pref-label {
  font-size: .7rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  pointer-events: none;
}
.ps-pref-label small {
  font-size: .55rem;
  display: block;
  color: var(--accent);
  opacity: .8;
}
.ps-pref-clear {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  background: rgba(200,30,30,.85);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: .55rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}
.ps-pref-clear.hidden { display: none; }
.ps-pref-preview {
  flex: 1;
  font-size: .65rem;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.plansheet-thumb-remove {
  background: rgba(0,0,0,.5);
  border: none;
  color: #fff;
  font-size: .65rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  margin-left: auto;
}
.plansheet-thumb-remove:hover { background: rgba(255,80,80,.85); }

/* Plansheet batch result items */
.plansheet-batch-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}

.plansheet-batch-num {
  position: absolute;
  top: 10px;
  right: 12px;
  background: var(--accent);
  color: #000;
  font-size: .75rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plansheet-batch-error {
  border-color: var(--danger);
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.plansheet-batch-pending {
  opacity: .6;
  align-items: center;
  gap: 12px;
}
.plansheet-pending-thumb {
  width: 160px;
  height: 108px;
  border-radius: 6px;
  background: var(--surface2, #2a2a2a);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.plansheet-pending-pulse {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.07) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: pending-sweep 1.4s linear infinite;
}
@keyframes pending-sweep {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.plansheet-pending-label {
  font-size: .8rem;
  color: var(--muted);
}

/* ── Plan Sheet Auto Button ──────────────────────────── */
.plansheet-action-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.plansheet-action-row .submit {
  flex: 1;
}

.auto-chip {
  cursor: pointer;
  user-select: none;
  display: flex;
}

.auto-chip input[type="checkbox"] {
  display: none;
}

.auto-chip-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: border-color .2s, color .2s, background .2s, box-shadow .2s;
  white-space: nowrap;
}

.auto-chip:hover .auto-chip-inner {
  border-color: var(--accent);
  color: var(--accent);
}

.auto-chip input:checked + .auto-chip-inner {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(67, 214, 166, .1);
  box-shadow: 0 0 16px rgba(67, 214, 166, .25);
}

.auto-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background .2s;
}

.auto-chip input:checked + .auto-chip-inner .auto-chip-dot {
  background: var(--accent);
  animation: auto-dot-pulse 1s ease-in-out infinite;
}

@keyframes auto-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.4); }
}

/* ── Batch Queue Panel (Reference to Video tab) ──────── */
.batch-queue-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 0;
}

.batch-queue-panel.hidden { display: none; }

.batch-queue-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.batch-queue-badge {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.batch-queue-meta {
  font-size: .84rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.batch-queue-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bq-card {
  display: flex;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color .2s;
}

.bq-card:hover { border-color: var(--accent); }

.bq-card-img-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}
.bq-card-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}
.bq-img-replace-btn {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.bq-card-img-wrap:hover .bq-img-replace-btn {
  opacity: 1;
  pointer-events: auto;
}
.bq-img-file-input {
  display: none;
}

.bq-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.bq-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bq-card-num {
  font-size: .76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.bq-card-status {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 99px;
  letter-spacing: .03em;
}

.bq-ready      { background: rgba(67,214,166,.12); color: var(--accent); }
.bq-queued     { background: rgba(200,200,60,.12); color: #c8c83c; }
.bq-generating { background: rgba(67,120,214,.15); color: #7eb8ff; animation: bq-pulse .9s ease-in-out infinite; }
.bq-done       { background: rgba(67,214,166,.22); color: var(--accent); }
.bq-error      { background: rgba(214,67,67,.15); color: #ff7e7e; }

@keyframes bq-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}

.bq-card-prompt {
  flex: 1;
  resize: vertical;
  font-family: monospace;
  font-size: .78rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 9px 10px;
  line-height: 1.55;
  min-height: 80px;
}

.bq-card-prompt:focus {
  outline: none;
  border-color: var(--accent);
}
.bq-card-reface {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  flex-wrap: wrap;
}
.bq-card-reface .reface-btn {
  padding: 6px 12px;
  font-size: .75rem;
  white-space: nowrap;
  align-self: flex-end;
}


.batch-queue-footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.batch-footer-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

.batch-footer-settings .field {
  flex: 1;
  min-width: 90px;
  max-width: 150px;
}

.batch-footer-settings .toggle {
  align-self: flex-end;
  padding-bottom: 5px;
}

/* ── Batch Retry Button ─────────────────────────────── */
.bq-retry-btn {
  margin-left: 8px;
  padding: 2px 8px;
  font-size: .7rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.bq-retry-btn:hover {
  border-color: var(--accent, #7c6fe0);
  color: var(--accent, #7c6fe0);
}

/* ── Batch Reference Images ─────────────────────────── */
.batch-ref-images {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.batch-ref-img-slot {
  position: relative;
  width: 80px;
  height: 80px;
}
.batch-ref-img-drop {
  width: 80px;
  height: 80px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  transition: border-color .15s;
  overflow: hidden;
}
.batch-ref-img-drop:hover,
.batch-ref-img-drop.drag-over {
  border-color: var(--accent, #7c6fe0);
}
.batch-ref-img-label {
  font-size: .68rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
  pointer-events: none;
}
.batch-ref-img-label small {
  display: block;
  font-size: .62rem;
  opacity: .7;
}
.batch-ref-img-clear {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--danger, #e05);
  color: #fff;
  font-size: .6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.batch-ref-img-clear.hidden { display: none; }

/* ── RE FACE Button ─────────────────────────────────── */
.reface-btn {
  background: linear-gradient(135deg, rgba(67,214,166,.15), rgba(67,214,166,.05));
  border-color: rgba(67,214,166,.4);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .03em;
}
.reface-btn:hover:not(:disabled) {
  background: rgba(67,214,166,.22);
  border-color: var(--accent);
}
.reface-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* ── Plan Sheet REMAKE ───────────────────────────────── */
.ps-scene-edit {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  color: var(--text, #f2f4f7);
  flex: 1;
  font-family: inherit;
  font-size: .78rem;
  line-height: 1.45;
  padding: 5px 8px;
  resize: vertical;
  width: 100%;
}
.ps-scene-edit:focus {
  border-color: rgba(255,255,255,.3);
  outline: none;
}

.plansheet-grid-image-wrap {
  position: relative;
}

.ps-card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ps-remake-btn {
  background: rgba(67,214,166,.12);
  border: 1.5px solid rgba(67,214,166,.5);
  border-radius: 6px;
  color: var(--accent, #43d6a6);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .03em;
  padding: 5px 12px;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.ps-remake-btn:hover:not(:disabled) {
  background: rgba(67,214,166,.25);
  transform: scale(1.04);
}
.ps-remake-btn:disabled {
  opacity: .7;
  cursor: not-allowed;
}

/* ── End Plan Sheet ──────────────────────────────────── */


/* ── Plan Sheet 체크박스 / REMAKE Selected ──────────────── */
.ps-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ps-remake-selected-btn {
  background: rgba(67,214,166,.12);
  border-color: rgba(67,214,166,.45);
  color: var(--accent, #43d6a6);
  font-weight: 700;
  font-size: .78rem;
  padding: 0 12px;
}
.ps-remake-selected-btn:hover:not(:disabled) {
  background: rgba(67,214,166,.22);
}
.ps-card-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ps-select-label {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 5px;
  user-select: none;
}
.ps-select-label .ps-select-text {
  color: var(--muted, #aaa);
  font-size: .72rem;
}
.ps-select-cb {
  accent-color: var(--accent, #43d6a6);
  cursor: pointer;
  height: 14px;
  width: 14px;
}

/* ── REMAKE Loading Animation ───────────────────────── */
@keyframes remake-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(67,214,166,.5); }
  50% { opacity: .85; box-shadow: 0 0 0 6px rgba(67,214,166,.0); }
}
@keyframes remake-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.ps-remake-btn.ps-remake-loading {
  animation: remake-pulse .9s ease-in-out infinite;
  background: rgba(67,214,166,.25);
  border-color: var(--accent, #43d6a6);
  color: #fff;
}
.ps-remake-btn.ps-remake-loading::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 7px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
/* 이미지 오버레이 shimmer — .plansheet-grid-image-wrap에 :has 또는 클래스로 */
.plansheet-grid-image-wrap.ps-img-generating::after {
  content: "Generating…";
  align-items: center;
  animation: remake-shimmer 1.4s linear infinite;
  background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(67,214,166,.18) 50%, rgba(0,0,0,.55) 100%);
  background-size: 400px 100%;
  border-radius: 8px;
  color: var(--accent, #43d6a6);
  display: flex;
  font-size: .82rem;
  font-weight: 700;
  inset: 0;
  justify-content: center;
  letter-spacing: .06em;
  position: absolute;
  z-index: 4;
}

/* ── Image Lightbox ───────────────────────────────────────── */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-lightbox.hidden { display: none; }
.img-lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(4px);
  z-index: 0;
}
#imgLightboxImg {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  object-fit: contain;
  cursor: zoom-out;
}
.img-lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.3);
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  backdrop-filter: blur(6px);
  transition: background .15s;
}
.img-lightbox-close:hover { background: rgba(255,255,255,.2); }

/* plansheet 이미지 클릭 커서 */
.plansheet-grid-image img { cursor: zoom-in; }

/* ── Plan Sheet 입력 모드 탭 ───────────────────────────────── */
.ps-input-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.ps-input-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
}
.ps-input-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124,111,224,.08);
  font-weight: 600;
}
.ps-prompt-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ps-prompt-textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  font-family: monospace;
  font-size: .8rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  line-height: 1.6;
  box-sizing: border-box;
}
.ps-prompt-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.ps-prompt-meta {
  font-size: .75rem;
  color: var(--muted);
  text-align: right;
}
.bq-card-body-full {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  flex: 1;
}

/* ===== Human Gallery Panel ===== */

/* ── Gallery Column ── */
.gal-col {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.gal-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.gal-header {
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  padding: 8px 4px 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.gal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gal-panel { margin: 10px 0; border: 1px solid #333; border-radius: 8px; overflow: hidden; }
.gal-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #1e1e2e; cursor: pointer; font-size: 13px; font-weight: 600; color: #cdd6f4; }
.gal-header:hover { background: #2a2a3e; }
.gal-arrow { font-size: 10px; transition: transform 0.2s; }
.gal-arrow.open { transform: rotate(90deg); }
.gal-body { padding: 10px; background: #12121a; }
.gal-gender-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.gal-tab { flex: 1; padding: 5px; background: #2a2a3e; color: #cdd6f4; border: none; border-radius: 5px; cursor: pointer; font-size: 12px; }
.gal-tab.active { background: #7f7fe0; color: #fff; }
.gal-filter-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.gal-filter { padding: 3px 8px; background: #2a2a3e; color: #cdd6f4; border: none; border-radius: 4px; cursor: pointer; font-size: 11px; }
.gal-filter.active { background: #5e5ec0; color: #fff; }
.gal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-height: 640px; overflow-y: auto; margin-bottom: 8px; }
.gal-img-wrap { position: relative; cursor: pointer; border-radius: 4px; overflow: hidden; background: #1e1e2e; }
.gal-img-wrap img { width: 100%; height: auto; display: block; }
.gal-img-wrap:hover img { opacity: 0.75; }
.gal-del-btn { position: absolute; top: 2px; right: 2px; background: rgba(220,50,50,0.85); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; line-height: 18px; text-align: center; cursor: pointer; display: none; padding: 0; }
.gal-img-wrap:hover .gal-del-btn { display: block; }
.gal-empty { color: #666; font-size: 12px; text-align: center; padding: 20px; grid-column: 1/-1; }
.gal-loading { color: #888; font-size: 12px; text-align: center; padding: 20px; grid-column: 1/-1; }
.gal-add-btn { display: block; text-align: center; padding: 6px; background: #2a2a3e; color: #aaa; border-radius: 5px; cursor: pointer; font-size: 12px; border: 1px dashed #444; }
.gal-add-btn:hover { background: #333; color: #cdd6f4; }
/* 팝업 */
.gal-lightbox { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.88); z-index: 9999; display: none; overflow: auto; }
.gal-lightbox.open { display: block; }
.gal-lightbox img { display: block; margin: 60px auto 80px; width: auto; height: auto; max-width: none; object-fit: none; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.7); cursor: grab; pointer-events: auto; }
.gal-lightbox img:active { cursor: grabbing; }
.gal-lb-arrow { position: fixed; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.15); border: none; color: #fff; font-size: 28px; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; z-index: 10000; transition: background 0.2s; display: flex; align-items: center; justify-content: center; }
.gal-lb-arrow:hover { background: rgba(255,255,255,0.28); }
.gal-lb-prev { left: 24px; }
.gal-lb-next { right: 24px; }
.gal-lb-dl { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); padding: 10px 28px; background: #2a7aff; color: #fff; border: none; border-radius: 24px; font-size: 14px; font-weight: 700; cursor: pointer; z-index: 10000; transition: background 0.2s, box-shadow 0.2s; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,0.5); letter-spacing: 0.3px; }
.gal-lb-dl:hover { background: #1a5fd4; box-shadow: 0 6px 20px rgba(0,0,0,0.6); }
.gal-lb-close { position: fixed; top: 18px; right: 24px; background: rgba(255,255,255,0.12); border: none; color: #fff; font-size: 18px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; z-index: 10000; transition: background 0.2s; }
.gal-lb-close:hover { background: rgba(255,255,255,0.28); }
/* 업로드 모달 */
.gal-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.gal-modal-inner { background: #1e1e2e; border-radius: 10px; padding: 20px; min-width: 260px; }
.gal-modal-inner h3 { color: #cdd6f4; margin-bottom: 14px; font-size: 14px; }
.gal-modal-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.gal-modal-row label { color: #aaa; font-size: 12px; width: 40px; }
.gal-modal-row select { flex: 1; background: #2a2a3e; color: #cdd6f4; border: 1px solid #444; border-radius: 4px; padding: 4px; font-size: 12px; }
.gal-modal-btns { display: flex; gap: 8px; margin-top: 14px; }
.gal-modal-btns button { flex: 1; padding: 7px; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.gal-modal-btns button:first-child { background: #5e5ec0; color: #fff; }
.gal-modal-btns button:last-child { background: #333; color: #aaa; }

.gal-age-badge {
  position: absolute;
  bottom: 5px;
  left: 5px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  letter-spacing: 0.3px;
}

/* 라이트박스 info 오버레이 */
.gal-lb-info {
  position: fixed;
  bottom: 28px;
  right: 24px;
  background: rgba(0,0,0,0.6);
  color: #eee;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
  letter-spacing: 0.5px;
  z-index: 10001;
}

/* Recommend 버튼 */
.gal-rec-btn {
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.gal-rec-btn:hover { background: #6d28d9; }
.gal-rec-btn:disabled { background: #aaa; cursor: not-allowed; }

/* 추천 이미지 테두리 + 배지 */
.gal-img-wrap.gal-rec-s0 { outline: 3px solid #ef4444; outline-offset: 2px; }
.gal-img-wrap.gal-rec-s1 { outline: 3px solid #f97316; outline-offset: 2px; }
.gal-rec-rank {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 20px;
  height: 20px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 11;
  padding: 0 4px;
  pointer-events: none;
}
.gal-img-wrap.gal-rec-s1 .gal-rec-rank { background: #f97316; }
.gal-img-wrap.gal-rec-s0 .gal-rec-rank,
.gal-img-wrap.gal-rec-s1 .gal-rec-rank { display: flex; }
