@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* 브랜드 팔레트 (블루 + 바이올렛 + 핑크 그라데이션 계열) */
  --color-blue: #2563eb;
  --color-violet: #7c3aed;
  --color-pink: #ec4899;
  --color-navy: #0f172a;

  --primary: var(--color-blue);
  --primary-dark: #1d4ed8;
  --accent: var(--color-violet);

  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --muted-soft: #94a3b8;

  --gradient-brand: linear-gradient(135deg, #2563eb 0%, #7c3aed 45%, #ec4899 100%);
  --gradient-brand-soft: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.08) 45%, rgba(236, 72, 153, 0.08) 100%);

  --radius-card: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-card-hover: 0 4px 8px rgba(15, 23, 42, 0.05), 0 16px 32px rgba(15, 23, 42, 0.08);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.15);

  --sidebar-width: 264px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
}

/* ---------------------------------------------------------------------- */
/* 앱 셸 (사이드바 + 메인 콘텐츠)                                             */
/* ---------------------------------------------------------------------- */

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

.sidebar-toggle-checkbox {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-navy);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

#sidebar-toggle:checked ~ .sidebar-backdrop {
  display: block;
}

#sidebar-toggle:checked ~ .sidebar {
  transform: translateX(0);
}

.sidebar-brand {
  padding: 8px 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

.sidebar-brand-name {
  display: block;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa 0%, #c084fc 55%, #f472b6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.02em;
}

.sidebar-brand-tagline {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.sidebar-link.active {
  background: var(--gradient-brand);
  color: #ffffff;
  font-weight: 700;
  border-left-color: #f8fafc;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}

.sidebar-link-icon {
  font-size: 16px;
  line-height: 1;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 16px;
  padding: 16px 8px 0;
}

.sidebar-footer-brand {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.sidebar-footer-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.sidebar-logout {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: #cbd5e1;
  text-decoration: none;
}

.sidebar-logout:hover {
  color: #f8fafc;
}

/* ---------------------------------------------------------------------- */
/* 관리자 콘솔 (/admin)                                                      */
/* ---------------------------------------------------------------------- */

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 14px 4px 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--gradient-brand);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  align-self: flex-start;
}

.admin-inline-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--gradient-brand-soft);
  border: 1px solid rgba(124, 58, 237, 0.18);
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.admin-stat {
  text-align: center;
  padding: 22px 18px;
}

.admin-stat-num {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-navy);
  line-height: 1.1;
}

.admin-stat-label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.admin-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-dl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

/* 관리자 작업 이력: 접근 역할 / 플랜 배지 */
.admin-role-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.badge-role-staff {
  background: #eff6ff;
  color: var(--primary);
}

.badge-role-tester {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
}

.badge-role-none {
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 500;
}

.badge-plan {
  background: #f8fafc;
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-plan-beta {
  background: var(--gradient-brand-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 58, 237, 0.18);
}

@media (max-width: 720px) {
  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 프리뷰 모드 배지 (사이드바 상단, 로그인 전에만 표시) */
.sidebar-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 14px 4px 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  background: var(--gradient-brand);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  align-self: flex-start;
}

.sidebar-preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
}

/* 베타 테스터 모드 배지 (사이드바 상단, 테스터 로그인 시) */
.sidebar-tester-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 14px 4px 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
  align-self: flex-start;
}

.sidebar-auth-status.tester {
  color: #f0abfc;
}

.sidebar-plan-mini {
  margin: 8px 0 12px;
}

.sidebar-plan-name {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.sidebar-plan-dot {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* /create 상단 dot 게이지 패널 (베타 테스터/직원) */
.dot-panel {
  padding: 18px 22px;
}

.dot-panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.dot-panel-plan {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-navy);
  margin-right: 8px;
}

.dot-panel-numbers {
  font-size: 14px;
  color: var(--text);
}

.dot-panel-numbers strong {
  font-size: 18px;
  color: var(--accent);
}

.dot-gauge-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 10px;
}

.dot-gauge-fill {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* 사이드바 하단 로그인 전/후 영역 */
.sidebar-auth {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.sidebar-auth-login,
.sidebar-auth-signup {
  flex: 1;
  text-align: center;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: filter 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.sidebar-auth-login {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.sidebar-auth-login:hover {
  filter: brightness(1.06);
}

.sidebar-auth-signup {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-auth-signup:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.sidebar-auth-status {
  font-size: 12px;
  font-weight: 700;
  color: #86efac;
  margin-bottom: 8px;
}

.app-main {
  min-width: 0;
}

.mobile-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 60;
}

.mobile-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 16px;
  cursor: pointer;
}

.mobile-topbar-brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}

@media (min-width: 900px) {
  .app-shell {
    display: flex;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    transform: none;
    flex-shrink: 0;
  }

  .sidebar-backdrop,
  .mobile-topbar {
    display: none !important;
  }

  .app-main {
    flex: 1;
  }
}

/* 인증 화면(access.html) 전용 - 사이드바 없이 중앙 정렬 */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.12), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(236, 72, 153, 0.12), transparent 45%), var(--bg);
  padding: 24px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.02em;
}

.auth-shell .container {
  padding: 0;
  max-width: 440px;
  width: 100%;
}

.auth-card {
  margin-bottom: 0;
}

.auth-card-head {
  margin-bottom: 18px;
}

.auth-card-title {
  margin: 0 0 6px;
  font-size: 24px;
}

.auth-card-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ---------------------------------------------------------------------- */
/* 컨테이너 / 페이지 헤더                                                    */
/* ---------------------------------------------------------------------- */

main.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

main.container.container-wide {
  max-width: 1280px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  margin-bottom: 6px;
}

.create-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@media (min-width: 900px) {
  .create-layout {
    grid-template-columns: 1.3fr 1fr;
  }
}

.create-left, .create-right {
  min-width: 0;
}

/* ---------------------------------------------------------------------- */
/* 카드                                                                      */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
  margin-bottom: 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--color-navy);
}

h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 0;
  color: var(--color-navy);
}

p.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------- */
/* 버튼                                                                      */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--gradient-brand);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.32);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: none;
  filter: none;
}

.btn.danger {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.btn.danger:hover {
  background: #b91c1c;
  filter: none;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn.btn-large {
  font-size: 16px;
  font-weight: 700;
  padding: 15px 28px;
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

/* ---------------------------------------------------------------------- */
/* 표                                                                        */
/* ---------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------- */
/* 폼                                                                        */
/* ---------------------------------------------------------------------- */

form.stack label {
  display: block;
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-navy);
}

form.stack input[type="text"],
form.stack input[type="password"],
form.stack input[type="number"],
form.stack input[type="url"],
form.stack textarea,
form.stack select,
.option-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

form.stack input[type="text"]:focus,
form.stack input[type="password"]:focus,
form.stack input[type="number"]:focus,
form.stack input[type="url"]:focus,
form.stack textarea:focus,
form.stack select:focus,
.option-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

form.stack textarea {
  min-height: 80px;
  resize: vertical;
}

input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  color: var(--muted);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
}

.actions-row {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------- */
/* 배지 (플랜/상태/잠금/dot 공통 디자인 시스템)                                 */
/* ---------------------------------------------------------------------- */

.badge {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary);
  border-radius: var(--radius-pill);
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
}

.badge-required {
  background: #fef2f2;
  color: #b91c1c;
  margin-left: 6px;
}

.badge-optional {
  background: #f1f5f9;
  color: var(--muted);
  margin-left: 6px;
}

.badge-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gradient-brand-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f1f5f9;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
}

/* /jobs, /create 결과 패널에서 쓰는 작업 진행 상태 배지 (waiting/in_progress/succeeded/failed) */
.status-badge {
  font-weight: 700;
}

.status-badge-waiting {
  background: #f1f5f9;
  color: var(--muted);
}

.status-badge-in_progress {
  background: var(--gradient-brand-soft);
  color: var(--accent);
}

.status-badge-succeeded {
  background: #f0fdf4;
  color: #166534;
}

.status-badge-failed {
  background: #fef2f2;
  color: #b91c1c;
}

.notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
}

.empty-state {
  text-align: center;
  padding: 48px 0;
  color: var(--muted);
}

/* 프리뷰 모드 안내 배너 / 빈 상태 카드 */
.preview-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--gradient-brand-soft);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text);
}

.preview-banner-badge {
  flex-shrink: 0;
  background: var(--gradient-brand);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

.preview-banner-text {
  color: var(--muted);
  line-height: 1.5;
}

.preview-empty {
  text-align: center;
  padding: 56px 24px;
}

.preview-empty-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 14px;
}

.preview-empty h2 {
  margin: 0 0 8px;
}

.preview-empty p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 auto 20px;
  max-width: 420px;
  line-height: 1.6;
}

.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
}

.error-box ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.success-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
}

.field-hint {
  color: var(--muted-soft);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.5;
}

.field-hint.warn {
  color: #92400e;
}

.field-hint a {
  color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* 진행 상태                                                                 */
/* ---------------------------------------------------------------------- */

.progress-container {
  margin-top: 16px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-brand);
  border-radius: var(--radius-pill);
  transition: width 0.6s ease;
}

.progress-step-text {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* 설정 탭 (편집설정/자막설정/음성설정)                                        */
/* ---------------------------------------------------------------------- */

.option-tabs-nav {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 4px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}

.option-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  border-radius: var(--radius-sm);
  flex: 1;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

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

.option-tab-btn.active {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

.option-tab-btn.locked {
  color: var(--muted-soft);
}

.option-tab-panel {
  display: none;
}

.option-tab-panel.active {
  display: block;
}

.option-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.option-fieldset:disabled {
  opacity: 0.5;
}

/* ---------------------------------------------------------------------- */
/* 자막 미리보기                                                              */
/* ---------------------------------------------------------------------- */

/* 자막설정 탭 내부 2열 레이아웃: 좌측 옵션 / 우측 미리보기.
   데스크톱은 2열, 모바일(좁은 화면)은 옵션 → 미리보기 순서로 1열 스택. */
.subtitle-settings-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.subtitle-settings-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.subtitle-settings-preview {
  min-width: 0;
}

.subtitle-settings-preview > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-navy);
}

@media (min-width: 680px) {
  .subtitle-settings-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
}

.subtitle-preview-canvas {
  position: relative;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 9 / 16;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-radius: 16px;
  margin: 8px 0;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

/* 자막 세로 위치 5단계 — 텍스트를 % 지점에 절대 배치한다. 상단/하단이 캔버스 끝에 붙지 않도록
   18%~82% 범위로 두어 실제 영상(ASS margin) 위치 체감과 비슷하게 맞춘다. */
.subtitle-preview-text {
  position: absolute;
  left: 50%;
  width: calc(100% - 24px);
  transform: translate(-50%, -50%);
  top: 82%;
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.subtitle-preview-canvas.position-top .subtitle-preview-text { top: 18%; }
.subtitle-preview-canvas.position-upper .subtitle-preview-text { top: 34%; }
.subtitle-preview-canvas.position-center .subtitle-preview-text { top: 50%; }
.subtitle-preview-canvas.position-middle .subtitle-preview-text { top: 50%; }
.subtitle-preview-canvas.position-lower .subtitle-preview-text { top: 66%; }
.subtitle-preview-canvas.position-bottom .subtitle-preview-text { top: 82%; }

.subtitle-preview-text.size-small {
  font-size: 14px;
}

.subtitle-preview-text.size-medium {
  font-size: 20px;
}

.subtitle-preview-text.size-large {
  font-size: 28px;
}

.subtitle-preview-text.style-basic {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

.subtitle-preview-text.style-emphasis {
  -webkit-text-stroke: 2px #000;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}

.subtitle-preview-text.style-simple {
  text-shadow: none;
}

/* ---------------------------------------------------------------------- */
/* 영상 업로드: 드래그앤드롭 + 카드 미리보기                                    */
/* ---------------------------------------------------------------------- */

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fafc;
  padding: 28px 20px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.upload-dropzone:hover {
  border-color: var(--accent);
  background: var(--gradient-brand-soft);
}

.upload-dropzone.dragover {
  border-color: var(--accent);
  background: var(--gradient-brand-soft);
  box-shadow: var(--shadow-focus);
}

.upload-dropzone.disabled,
.upload-dropzone.disabled:hover {
  cursor: default;
  opacity: 0.6;
  border-color: #cbd5e1;
  background: #f8fafc;
  box-shadow: none;
}

.upload-dropzone-icon {
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}

.upload-dropzone-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-navy);
}

.upload-dropzone-sub {
  font-size: 12px;
  color: var(--muted);
}

.upload-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 1100px) {
  .upload-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .upload-card-grid {
    grid-template-columns: 1fr;
  }
}

.upload-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

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

.upload-card-meta {
  padding: 8px 10px;
}

.upload-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.upload-card-del {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-card-del:hover {
  background: #dc2626;
}

.upload-legal {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted-soft);
  margin-top: 12px;
}

.upload-legal a {
  color: var(--muted);
  text-decoration: underline;
}

/* 자막 색상 프리셋 + color input */
.color-picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-picker-row input[type="color"] {
  width: 38px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* 하위 탭 (파일 업로드 / 틱톡 URL)                                            */
/* ---------------------------------------------------------------------- */

.tab-buttons {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.url-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.url-row input {
  flex: 1;
}

.btn-icon {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--text);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.option-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-navy);
}

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

.result-table td, .result-table th {
  font-size: 13px;
}

.section-title {
  margin-top: 28px;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--color-navy);
}

.form-section {
  margin-bottom: 20px;
}

.section-desc {
  margin-top: -4px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.video-preview {
  display: block;
  width: 100%;
  max-width: 220px;
  max-height: 390px;
  border-radius: 14px;
  background: #000;
  margin-top: 12px;
  box-shadow: var(--shadow-card);
}

.video-preview-details {
  margin-top: 8px;
}

.video-preview-details summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  user-select: none;
  font-weight: 600;
}

/* Typecast 성우 선택: 이름 중심의 컴팩트 카드 그리드. 데스크톱 4열 / 태블릿 2열 / 모바일 1열. */
.voice-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding: 4px;
}

@media (min-width: 560px) {
  .voice-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .voice-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.voice-row {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 46px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.voice-row:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.voice-row.selected {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    var(--gradient-brand) border-box;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18);
}

.voice-star {
  position: absolute;
  top: 3px;
  right: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 3px;
  color: var(--muted-soft);
  z-index: 1;
}

.voice-star.favorited {
  color: #eab308;
}

.voice-name-btn {
  flex: 1;
  text-align: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  border-radius: var(--radius-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-row.selected .voice-name-btn {
  font-weight: 700;
  color: var(--primary);
}

/* 음성 속도(슬라이더) / 피치(버튼) / 감정(표시) 컨트롤 영역 */
.voice-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 18px;
}

.voice-value-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--gradient-brand-soft);
  border: 1px solid rgba(124, 58, 237, 0.18);
  vertical-align: middle;
}

.voice-slider {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
  cursor: pointer;
}

.pitch-btn-group {
  display: flex;
  gap: 8px;
}

.pitch-btn {
  flex: 1;
  padding: 10px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.pitch-btn:hover {
  border-color: #cbd5e1;
  color: var(--text);
}

.pitch-btn.selected {
  border: 1px solid transparent;
  color: #fff;
  background: var(--gradient-brand);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

/* ---------------------------------------------------------------------- */
/* 작업 이력 카드                                                             */
/* ---------------------------------------------------------------------- */

.job-card-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.job-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px 26px;
  transition: box-shadow 0.15s ease;
}

.job-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.job-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.job-card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--color-navy);
}

.job-card-summary {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.job-card-meta {
  margin: 0;
  color: var(--muted-soft);
  font-size: 12px;
}

.job-card-badges {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.job-card-body {
  list-style: none;
  margin: 0 0 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 20px;
  font-size: 13px;
}

.job-card-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.job-card-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.job-card-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------------------------------------------------------------------- */
/* 요금제 카드                                                                */
/* ---------------------------------------------------------------------- */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin: 24px 0;
}

.plan-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.plan-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.plan-card-highlight {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    var(--gradient-brand) border-box;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.18);
}

.plan-badge {
  position: absolute;
  top: -12px;
  right: 18px;
  background: var(--gradient-brand);
  color: white;
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

.plan-name {
  font-size: 17px;
  font-weight: 700;
  margin: 4px 0 14px;
  color: var(--muted);
}

.plan-price {
  margin-bottom: 14px;
}

.plan-price-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-navy);
  letter-spacing: -0.01em;
}

.plan-price-unit {
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
}

.plan-facts {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-annual-note {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  background: var(--gradient-brand-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0 0 18px;
}

.plan-cta {
  margin-top: auto;
  text-align: center;
}

.plan-compare-table th:first-child,
.plan-compare-table td:first-child {
  white-space: nowrap;
}

.plan-compare-table th,
.plan-compare-table td {
  text-align: center;
}

.plan-compare-table thead th:first-child,
.plan-compare-table tbody th {
  text-align: left;
  text-transform: none;
  color: var(--text);
  font-size: 14px;
}

.dot-info-box p {
  margin: 4px 0;
}

/* ---------------------------------------------------------------------- */
/* 결과 상세 (details/summary)                                               */
/* ---------------------------------------------------------------------- */

.result-details {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.result-details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  user-select: none;
}

.result-summary-line {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
}

/* ---------------------------------------------------------------------- */
/* 추가 dot 구매                                                              */
/* ---------------------------------------------------------------------- */

.dot-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.dot-option-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.dot-option-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.dot-option-price {
  font-size: 19px;
  font-weight: 700;
  color: var(--color-navy);
}

.dot-purchase-price {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
}

.dot-option-cta {
  width: 100%;
  text-align: center;
  margin-top: auto;
}
