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

/* ══════════════════════════════════
   RESET & BASE
   ══════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f7f7f5;
  color: #1a1a1a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════
   TOP NAVIGATION
   ══════════════════════════════════ */
.top-bar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e8e8e4;
}
.top-bar-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.logo {
  font-size: 15px;
  font-weight: 700;
  color: #37352f;
  letter-spacing: -0.01em;
}
.tabs { display: flex; gap: 2px; }
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: none;
  color: #9b9a97;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  font-family: inherit;
}
.tab-btn:hover { background: #f0f0ee; color: #37352f; }
.tab-btn.active { background: #f0f0ee; color: #37352f; font-weight: 600; }

/* ══════════════════════════════════
   LAYOUT
   ══════════════════════════════════ */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 100px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════ */
.page-header { margin-bottom: 32px; }
.page-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9b9a97;
  margin-bottom: 6px;
}
.page-header h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #37352f;
  margin-bottom: 6px;
}
.page-desc {
  font-size: 14px;
  color: #787774;
}

/* ══════════════════════════════════
   SECTIONS
   ══════════════════════════════════ */
.section {
  margin-bottom: 24px;
  background: #fff;
  border: 1px solid #e8e8e4;
  border-radius: 10px;
  padding: 24px;
}
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0ee;
}
.section-icon { font-size: 22px; margin-top: 1px; }
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #37352f;
}
.section-desc {
  font-size: 13px;
  color: #9b9a97;
  margin-top: 2px;
}

/* ══════════════════════════════════
   FORMS
   ══════════════════════════════════ */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.form-group > input,
.form-group > textarea,
.form-group > select {
  width: 100%;
}
.form-group.wide { flex: 2; }
.form-group.narrow { flex: 0 0 140px; }

label {
  font-size: 12px;
  font-weight: 600;
  color: #787774;
  letter-spacing: 0.01em;
}

.channel-handle-row {
  display: flex;
  align-items: stretch;
}

.channel-url-prefix-input {
  width: 185px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-right: none;
  border-radius: 6px 0 0 6px;
  background: #f9fafb;
  color: #6b7280 !important;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none !important;
  box-shadow: none;
  pointer-events: none;
}

.channel-url-prefix-input:focus {
  border-color: #d1d5db;
  box-shadow: none;
}

.channel-url-prefix-input::selection {
  background: transparent;
}

.channel-handle-input {
  flex: 1;
  width: 100%;
  margin: 0;
  padding-left: 12px;
  border: 1px solid #d1d5db;
  border-radius: 0 6px 6px 0;
  background: #fafaf8;
}

.channel-handle-input::placeholder {
  color: #c4c3bf;
}

input, textarea, select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #e8e8e4;
  border-radius: 6px;
  background: #fafaf8;
  color: #37352f;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: #37352f;
  box-shadow: 0 0 0 3px rgba(55,53,47,0.06);
}
input::placeholder, textarea::placeholder { color: #c4c3bf; }
textarea { resize: vertical; min-height: 72px; }

/* ── API ROW ── */
.api-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 4px;
}
.api-status {
  font-size: 13px;
  min-height: 20px;
  padding: 2px 0;
}
.api-status.success { color: #0f7b0f; }
.api-status.error { color: #e03e3e; }
.api-status.loading { color: #9b9a97; }

/* ══════════════════════════════════
   BUTTONS
   ══════════════════════════════════ */
.btn-test {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  background: #f0f0ee;
  border: 1px solid #e8e8e4;
  border-radius: 6px;
  color: #37352f;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
  height: 38px;
}
.btn-test:hover { background: #e8e8e4; }

.btn-primary {
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 700;
  background: #37352f;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-primary:hover {
  background: #525048;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(55,53,47,0.15);
}

.btn-secondary {
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  color: #37352f;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: #37352f; }

.btn-ghost {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  background: none;
  color: #9b9a97;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}
.btn-ghost:hover { color: #e03e3e; }

/* AI 버튼 — 보조 역할, 눈에 덜 띄게 */
.btn-ai-subtle {
  margin-top: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  color: #9b9a97;
  border: 1px dashed #d4d4d0;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  align-self: flex-start;
}
.btn-ai-subtle:hover {
  color: #6366f1;
  border-color: #6366f1;
  background: #f5f3ff;
}
.btn-ai-subtle:disabled {
  opacity: 0.6;
  cursor: wait;
}

.action-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e8e8e4;
}

/* ══════════════════════════════════
   GUIDE ACCORDION
   ══════════════════════════════════ */
.guide-accordion {
  margin-top: 16px;
  border: 1px solid #f0f0ee;
  border-radius: 8px;
  overflow: hidden;
}
.guide-accordion summary {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #787774;
  cursor: pointer;
  background: #fafaf8;
  transition: background 0.15s;
  list-style: none;
}
.guide-accordion summary::-webkit-details-marker { display: none; }
.guide-accordion summary::before {
  content: '▸ ';
  transition: transform 0.15s;
}
.guide-accordion[open] summary::before { content: '▾ '; }
.guide-accordion summary:hover { background: #f0f0ee; }

.guide-content {
  padding: 16px;
  font-size: 13px;
  color: #525048;
  line-height: 1.8;
}
.guide-content ol {
  padding-left: 20px;
  margin: 8px 0;
}
.guide-content li { margin-bottom: 6px; }
.guide-content a {
  color: #37352f;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.guide-content a:hover { color: #0f7b0f; }
.guide-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: #f0f0ee;
  border-radius: 6px;
  font-size: 13px;
  color: #787774;
}

/* ══════════════════════════════════
   OPTIONAL SECTION (선택 기능 접기)
   ══════════════════════════════════ */
.optional-section {
  margin-top: 32px;
  border-top: 1px solid #e8e8e4;
}
.optional-section-toggle {
  display: block;
  padding: 16px 0;
  font-size: 14px;
  font-weight: 500;
  color: #9b9a97;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s;
}
.optional-section-toggle::-webkit-details-marker { display: none; }
.optional-section-toggle::before { content: '▸ '; }
.optional-section[open] > .optional-section-toggle::before { content: '▾ '; }
.optional-section-toggle:hover { color: #37352f; }
.optional-section-body { padding-bottom: 8px; }

.badge-optional {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f0f0ee;
  color: #9b9a97;
  margin-left: 6px;
  vertical-align: middle;
}

/* ══════════════════════════════════
   USAGE LEVEL CARDS
   ══════════════════════════════════ */
.usage-levels {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.usage-card {
  flex: 1;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
  padding: 16px;
  background: #fafaf8;
}
.usage-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.usage-badge.level-1 { background: #e8f5e9; color: #2e7d32; }
.usage-badge.level-2 { background: #e3f2fd; color: #1565c0; }
.usage-badge.level-3 { background: #fff3e0; color: #e65100; }
.usage-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #37352f;
  margin-bottom: 4px;
}
.usage-card-desc {
  font-size: 12px;
  color: #787774;
  margin-bottom: 10px;
}
.usage-features {
  list-style: none;
  padding: 0;
  margin: 0;
}
.usage-features li {
  font-size: 13px;
  color: #525048;
  padding: 3px 0;
  padding-left: 18px;
  position: relative;
}
.usage-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 600;
}

/* ══════════════════════════════════
   TOAST
   ══════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 28px;
  background: #37352f;
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  font-family: inherit;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* (RESPONSIVE 섹션은 파일 맨 끝으로 이동됨 — 캐스케이드 순서 보장) */

/* ══════════════════════════════════
   NOTICE BOX
   ══════════════════════════════════ */
.notice-box {
  padding: 14px 18px;
  background: #faf3dd;
  border: 1px solid #ede3c0;
  border-radius: 8px;
  font-size: 13px;
  color: #6b5c1e;
  line-height: 1.6;
}
.notice-box a { color: #37352f; font-weight: 600; }

/* ══════════════════════════════════
   VIDEOS RESULT AREA
   ══════════════════════════════════ */
.videos-summary {
  padding: 12px 16px;
  background: #f0f0ee;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #37352f;
  margin-bottom: 20px;
}

.video-type-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.video-type-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #37352f;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #37352f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.btn-add {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border: 1px dashed #d4d4d0;
  border-radius: 6px;
  background: #fff;
  color: #787774;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-add:hover { border-color: #37352f; color: #37352f; }

/* ── VIDEO CARD ── */
.video-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.video-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s;
}
.video-card:hover { border-color: #c8c8c4; }

.video-card-body {
  display: flex;
  gap: 14px;
  padding: 12px;
}

.video-thumb {
  width: 160px;
  height: 90px;
  border-radius: 6px;
  background: #f0f0ee;
  object-fit: cover;
  flex-shrink: 0;
}
.video-thumb-placeholder {
  width: 160px;
  height: 90px;
  border-radius: 6px;
  background: #f0f0ee;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c4c3bf;
  font-size: 28px;
  flex-shrink: 0;
}

.video-info { flex: 1; min-width: 0; }
.video-title {
  font-size: 14px;
  font-weight: 600;
  color: #37352f;
  margin-bottom: 6px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #9b9a97;
}
.video-meta span { display: flex; align-items: center; gap: 3px; }

/* 영상 카드 분석 데이터 행 */
.video-analytics-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #6b6b6b;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e9e9e7;
}

.video-actions {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}

.btn-type-toggle {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid #e8e8e4;
  background: #fafaf8;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-type-toggle.long { color: #2563eb; border-color: #bfdbfe; background: #eff6ff; }
.btn-type-toggle.short { color: #d97706; border-color: #fde68a; background: #fffbeb; }
.btn-type-toggle:hover { opacity: 0.8; }

.btn-remove-card {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #e8e8e4;
  background: #fff;
  color: #c4c3bf;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-remove-card:hover { border-color: #e03e3e; color: #e03e3e; background: #fef2f2; }

/* ── MANUAL INPUT CARD ── */
.video-card-manual {
  padding: 14px;
  border: 1px dashed #d4d4d0;
  border-radius: 8px;
  background: #fafaf8;
  overflow: hidden;
}
.video-card-manual .form-row { margin-bottom: 8px; }
.video-card-manual .form-row:last-child { margin-bottom: 0; }

/* ── TYPE SUMMARY ── */
.type-summary {
  padding: 16px;
  background: #fafaf8;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
  margin-bottom: 8px;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.summary-label {
  font-size: 11px;
  font-weight: 500;
  color: #9b9a97;
  letter-spacing: 0.02em;
}
.summary-value {
  font-size: 18px;
  font-weight: 700;
  color: #37352f;
  letter-spacing: -0.02em;
}

.section-divider {
  height: 1px;
  background: #e8e8e4;
  margin: 24px 0;
}

/* ── STATUS BADGE ── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.done { background: #f0fdf4; color: #16a34a; }
.status-badge.wip { background: #fefce8; color: #ca8a04; }

/* ══════════════════════════════════
   STATS TABLE (Step 3)
   ══════════════════════════════════ */
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th {
  text-align: left; padding: 8px 12px;
  font-size: 12px; font-weight: 600; color: #9b9a97;
  border-bottom: 2px solid #e8e8e4;
}
.stats-table td { padding: 8px 12px; border-bottom: 1px solid #f0f0ee; }
.stats-table td:first-child { font-weight: 600; color: #37352f; width: 120px; }
.stats-table input { width: 100%; }
.growth-cell { font-weight: 700; font-size: 13px; white-space: nowrap; }
.growth-cell.up { color: #0f7b0f; }
.growth-cell.down { color: #e03e3e; }

/* ── STRATEGY CARD (제목 + 설명) ── */
.strategy-card {
  border: 1px solid #e9e9e7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 10px;
  background: #fff;
}
.strategy-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.strategy-card .strategy-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: #37352f; color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.strategy-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.strategy-card .strategy-title {
  width: 100%;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid #e9e9e7;
  border-radius: 4px;
  padding: 6px 10px;
}
.strategy-card .strategy-desc {
  width: 100%;
  font-size: 13px;
  border: 1px solid #e9e9e7;
  border-radius: 4px;
  padding: 6px 10px;
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
}

/* ══════════════════════════════════
   PREVIEW & PUBLISH (Step 4)
   ══════════════════════════════════ */
.preview-actions {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.preview-box {
  background: #fff; border: 1px solid #e8e8e4; border-radius: 12px;
  padding: 40px 36px; line-height: 1.8;
}
.preview-box h1 { font-size: 26px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.02em; }
.preview-box h2 { font-size: 18px; font-weight: 700; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #e8e8e4; }
.preview-box h3 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: #525048; }
.preview-box p { margin-bottom: 8px; font-size: 14px; color: #37352f; }
.preview-box table { width: 100%; border-collapse: collapse; margin: 12px 0 16px; font-size: 13px; }
.preview-box th { text-align: left; padding: 6px 10px; border-bottom: 2px solid #e8e8e4; font-size: 12px; color: #9b9a97; font-weight: 500; }
.preview-box td { padding: 6px 10px; border-bottom: 1px solid #f0f0ee; color: #37352f; }
.preview-box blockquote { border-left: 3px solid #37352f; padding: 12px 16px; margin: 14px 0; background: #fafaf8; border-radius: 0 8px 8px 0; font-size: 14px; color: #525048; }
.preview-box hr { border: none; border-top: 1px solid #e8e8e4; margin: 28px 0; }
.preview-box .pv-stat-grid { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; }
.preview-box .pv-stat-card { flex: 1 1 160px; padding: 14px 18px; border: 1px solid #e8e8e4; border-radius: 8px; }
.preview-box .pv-stat-label { font-size: 12px; color: #9b9a97; }
.preview-box .pv-stat-value { font-size: 22px; font-weight: 700; margin: 2px 0; }
.preview-box .pv-stat-growth { font-size: 12px; }
.preview-box .pv-stat-growth.up { color: #0f7b0f; }
.preview-box .pv-stat-growth.down { color: #e03e3e; }
.preview-box .pv-footer { font-size: 13px; color: #9b9a97; text-align: center; margin-top: 8px; }
.preview-box .pv-progress { height: 8px; background: #f0f0ee; border-radius: 4px; overflow: hidden; margin: 8px 0 16px; }
.preview-box .pv-progress-fill { height: 100%; border-radius: 4px; }
.preview-box .pv-video-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; margin-bottom: 8px;
  border: 1px solid #e9e9e7; border-radius: 8px; background: #fff;
}
.preview-box .pv-video-item:last-child { margin-bottom: 0; }
.preview-box .pv-video-rank {
  width: 28px; height: 28px; border-radius: 50%; background: #f0f0ee;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #6b6b6b; flex-shrink: 0;
}
.preview-box .pv-video-thumb {
  width: 120px; height: 68px; object-fit: cover; border-radius: 6px; flex-shrink: 0;
}
.preview-box .pv-video-info { flex: 1; min-width: 0; }
.preview-box .pv-video-title {
  font-weight: 600; font-size: 14px; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-box .pv-video-title a { color: inherit; text-decoration: none; }
.preview-box .pv-video-title a:hover { text-decoration: underline; color: #2563eb; }
.preview-box .pv-video-meta { font-size: 12px; color: #9b9a97; display: flex; gap: 10px; flex-wrap: wrap; }
.preview-box .pv-video-thumb { width: 120px; height: 68px; border-radius: 6px; object-fit: cover; background: #f0f0ee; flex-shrink: 0; }
.preview-box .pv-video-info { flex: 1; }
.preview-box .pv-video-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.preview-box .pv-video-meta { font-size: 12px; color: #9b9a97; display: flex; gap: 10px; flex-wrap: wrap; }

/* 미리보기 분석 데이터 */
.pv-video-analytics {
  font-size: 11px;
  color: #6b6b6b;
  margin-top: 4px;
}

.output-box {
  background: #fafaf8; border: 1px solid #e8e8e4; border-radius: 10px;
  padding: 20px; font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  max-height: 500px; overflow-y: auto; color: #525048;
}

/* ══════════════════════════════════
   CALENDAR VIEW
   ══════════════════════════════════ */
.calendar-section {
  margin-top: 20px;
}
.calendar-title {
  font-size: 15px;
  font-weight: 700;
  color: #37352f;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 10px;
}
.calendar-nav-title {
  font-size: 14px;
  font-weight: 700;
  color: #37352f;
  min-width: 100px;
  text-align: center;
}
.calendar-nav-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #e8e8e4;
  border-radius: 6px;
  background: #fff;
  color: #37352f;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}
.calendar-nav-btn:hover:not(:disabled) { background: #f0f0ee; }
.calendar-nav-btn:disabled { opacity: 0.3; cursor: default; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid #e8e8e4;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  width: 100%;
  table-layout: fixed;
}
.calendar-day-header {
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #9b9a97;
  background: #fafaf8;
  border-bottom: 1px solid #e8e8e4;
}
.calendar-day-header.sun { color: #e03e3e; }
.calendar-day-header.sat { color: #2563eb; }
.calendar-cell {
  min-height: 80px;
  padding: 4px;
  border-right: 1px solid #f0f0ee;
  border-bottom: 1px solid #f0f0ee;
  position: relative;
  background: #fff;
  vertical-align: top;
  overflow: hidden;
  min-width: 0;
}
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-cell.empty {
  background: #fafaf8;
  min-height: 80px;
  overflow: hidden;
  min-width: 0;
}
.calendar-cell.has-video {
  background: #fafff8;
}
.calendar-date {
  font-size: 12px;
  font-weight: 600;
  color: #787774;
  margin-bottom: 4px;
  padding: 2px 4px;
}
.calendar-cell.sun .calendar-date { color: #e03e3e; }
.calendar-cell.sat .calendar-date { color: #2563eb; }
.calendar-video-badge {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 3px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  max-width: 100%;
}
.calendar-video-badge.long {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.calendar-video-badge.short {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}
.cal-type-tag {
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
}
.calendar-video-views {
  font-size: 9px;
  color: #9b9a97;
  margin-left: auto;
  flex-shrink: 0;
}

/* 미리보기 보고서 내 달력 */
.pv-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid #e9e9e7;
  border-radius: 8px;
  overflow: hidden;
  margin: 12px 0 16px;
  font-size: 12px;
}
.pv-calendar-header {
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #9b9a97;
  background: #f7f6f3;
  border-bottom: 1px solid #e9e9e7;
}
.pv-calendar-header.sun { color: #e03e3e; }
.pv-calendar-header.sat { color: #2563eb; }
.pv-calendar-cell {
  min-height: 60px;
  padding: 3px;
  border-right: 1px solid #f0f0ee;
  border-bottom: 1px solid #f0f0ee;
  background: #fff;
}
.pv-calendar-cell:nth-child(7n) { border-right: none; }
.pv-calendar-cell.empty { background: #fafaf8; }
.pv-calendar-cell.has-video { background: #f8fdf5; }
.pv-calendar-date {
  font-size: 11px;
  font-weight: 600;
  color: #787774;
  margin-bottom: 2px;
  padding: 1px 3px;
}
.pv-calendar-cell.sun .pv-calendar-date { color: #e03e3e; }
.pv-calendar-cell.sat .pv-calendar-date { color: #2563eb; }
.pv-calendar-badge {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-calendar-badge.long { background: #eff6ff; color: #2563eb; }
.pv-calendar-badge.short { background: #fffbeb; color: #d97706; }

/* ══════════════════════════════════
   MANUAL ANALYTICS INPUT & IMAGE
   ══════════════════════════════════ */
.video-analytics-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #787774;
  cursor: pointer;
  border-top: 1px solid #f0f0ee;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  font-family: inherit;
  transition: all 0.15s;
}
.video-analytics-toggle:hover { color: #37352f; background: #fafaf8; }
.video-analytics-toggle .toggle-arrow { transition: transform 0.2s; display: inline-block; }
.video-analytics-toggle.open .toggle-arrow { transform: rotate(90deg); }

.video-analytics-panel {
  display: none;
  padding: 12px;
  border-top: 1px solid #f0f0ee;
  background: #fafaf8;
}
.video-analytics-panel.open { display: block; }
.video-analytics-panel.always-visible { display: block; }

.analytics-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #9b9a97;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.analytics-input-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

/* OAuth 상세 분석 토글 */
.analytics-fetch-toggle {
  border: 1px dashed #d4d4d0;
  border-radius: 8px;
}
.analytics-fetch-toggle summary {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #9b9a97;
  cursor: pointer;
  list-style: none;
}
.analytics-fetch-toggle summary::-webkit-details-marker { display: none; }
.analytics-fetch-toggle summary::before { content: '▸ '; }
.analytics-fetch-toggle[open] summary::before { content: '▾ '; }
.analytics-input-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.analytics-input-item label {
  font-size: 11px;
  font-weight: 600;
  color: #9b9a97;
}
.analytics-input-item input {
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid #e8e8e4;
  border-radius: 4px;
  background: #fff;
  width: 100%;
}

.image-drop-zone {
  border: 2px dashed #d4d4d0;
  border-radius: 8px;
  padding: 20px 16px;
  text-align: center;
  color: #9b9a97;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 60px;
}
.image-drop-zone:hover,
.image-drop-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}
.image-drop-zone.has-image {
  padding: 8px;
  border-style: solid;
  border-color: #e8e8e4;
  cursor: default;
}
.image-drop-zone img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
}
.image-remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.image-remove-btn:hover { background: rgba(224,62,62,0.9); }

.analytics-data-badge {
  font-size: 10px;
  color: #16a34a;
  margin-left: 4px;
}

/* ══════════════════════════════════
   RESPONSIVE (파일 맨 끝 — 캐스케이드 순서 보장)
   ══════════════════════════════════ */
@media (max-width: 640px) {
  .top-bar-inner { flex-direction: column; height: auto; padding: 10px 16px; gap: 8px; }
  .tabs { width: 100%; justify-content: center; }
  .container { padding: 24px 16px 80px; }
  .form-row, .api-row { flex-direction: column; }
  .form-group.narrow { flex: 1; }
  .video-card-body { flex-direction: column; }
  .video-thumb { width: 100%; height: auto; aspect-ratio: 16/9; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── date input: iOS 자동 줌 방지 + 전체 너비 ── */
  input[type="date"] {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  /* ── 영상 불러오기 버튼 전체 너비 ── */
  #fetch-videos-btn {
    width: 100%;
  }

  /* ── section overflow 허용 (date picker 잘림 방지) ── */
  .section {
    overflow: visible;
  }

  /* ── 미리보기 탭: preview-actions 세로 배치 ── */
  .preview-actions {
    flex-direction: column;
  }
  .preview-actions .btn-primary,
  .preview-actions .btn-secondary,
  .preview-actions .btn-ghost {
    width: 100%;
    text-align: center;
  }

  /* ── 미리보기 탭: preview-box 패딩 축소 ── */
  .preview-box {
    padding: 24px 16px;
  }

  /* ── 미리보기 탭: 성과 카드 1컬럼 ── */
  .preview-box .pv-stat-grid {
    flex-direction: column;
  }
  .preview-box .pv-stat-card {
    flex: 1 1 auto;
  }

  /* ── 미리보기 탭: 영상 아이템 세로 배치 ── */
  .preview-box .pv-video-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .preview-box .pv-video-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .preview-box .pv-video-title {
    white-space: normal;
  }

  /* ── 미리보기 탭: 달력 그리드 모바일 대응 ── */
  .preview-box .pv-calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    font-size: 10px;
  }
  .preview-box .pv-calendar-cell {
    min-height: 48px;
    padding: 2px;
  }
  .preview-box .pv-calendar-badge {
    font-size: 7px;
    padding: 1px 2px;
    gap: 1px;
  }
  .preview-box .pv-calendar-date {
    font-size: 10px;
  }
  .preview-box .pv-calendar-header {
    font-size: 10px;
    padding: 4px 2px;
  }

  /* ── 상세 데이터 입력 그리드 모바일 ── */
  .analytics-input-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── 데이터 입력 탭: 달력 그리드 모바일 대응 ── */
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .calendar-cell {
    min-height: 60px;
    padding: 2px;
  }
  .calendar-video-badge {
    font-size: 8px;
    padding: 1px 2px;
  }
  .calendar-video-views {
    font-size: 7px;
  }
}
