/* ==========================================================================
   원격 다운로더 프리미엄 모던 다크 테마 디자인 시스템
   ========================================================================== */

:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #121722;
  --bg-card: rgba(23, 29, 44, 0.7);
  --bg-card-hover: rgba(30, 38, 58, 0.85);
  --bg-input: #151b29;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --accent-glow: rgba(99, 102, 241, 0.25);

  --status-green: #10b981;
  --status-blue: #3b82f6;
  --status-purple: #8b5cf6;
  --status-yellow: #f59e0b;
  --status-red: #ef4444;

  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--accent-glow);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(236, 72, 153, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 16px;
}

/* 컨테이너 */
.app-container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 60px;
  overflow-x: hidden;
}

.tab-label-short {
  display: none;
}

.tab-label-full {
  display: inline;
}

/* 상단 헤더 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 6px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--status-green);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-green);
}

.status-dot.pulse {
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* 실시간 통계 바 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.stat-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrapper svg {
  width: 20px;
  height: 20px;
}

.stat-icon-wrapper.blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--status-blue);
}

.stat-icon-wrapper.purple {
  background: rgba(139, 92, 246, 0.12);
  color: var(--status-purple);
}

.stat-icon-wrapper.green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-green);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

/* 공통 카드 스타일 */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.card-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

/* 서비스 뱃지 */
.service-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.badge-gofile {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-viking {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.3);
}

.badge-megaup {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-mega {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-romsfun {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.badge-romspure {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-wowroms {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-planetemu {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-vimm {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.badge-mediafire {
  background: rgba(0, 114, 255, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(0, 114, 255, 0.3);
}
.badge-filekeeper {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-datanodes {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge-buzzheavier {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-rootz {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-mybox {
  background: rgba(3, 199, 90, 0.15);
  color: #00c73c;
  border: 1px solid rgba(3, 199, 90, 0.3);
}

.badge-naver {
  background: rgba(3, 199, 90, 0.15);
  color: #03c75a;
  border: 1px solid rgba(3, 199, 90, 0.3);
}

.badge-tistory {
  background: rgba(255, 86, 56, 0.15);
  color: #ff6a4d;
  border: 1px solid rgba(255, 86, 56, 0.3);
}

.badge-terabox {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-gigafile {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.badge-transferit {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-onefichier {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-kio {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.3);
}

.badge-gdrive {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-direct {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-torrent {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-xshare {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-guide-btn {
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  margin-left: auto;
}

.badge-guide-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

/* 입력 폼 */
.download-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-wrapper {
  position: relative;
}

.url-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 14px 14px 46px 14px;
  resize: vertical;
  min-height: 112px;
  max-height: 380px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.55;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox: 스크롤바 숨김 */
  -ms-overflow-style: none; /* IE/Edge */
}

/* Chrome, Safari, Edge 웹킷 스크롤바 숨김 */
.url-textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.url-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-action-buttons {
  position: absolute;
  bottom: 10px;
  right: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 2;
}

.input-action-buttons .paste-btn {
  position: static;
}

.paste-btn {
  position: absolute;
  bottom: 10px;
  right: 14px;
  background: rgba(30, 38, 58, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
}

.paste-btn svg {
  width: 13px;
  height: 13px;
}

.paste-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

/* 서브 입력창 (폴더 및 테라박스 비밀번호) */
.sub-inputs-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sub-input-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.sub-input-box svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.sub-input-box input {
  background: transparent;
  border: none;
  font-size: 0.82rem;
  width: 100%;
  outline: none;
}

.folder-input-box {
  flex: 2;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
}

.folder-input-box svg {
  color: var(--accent-primary);
}

.folder-input-box input {
  color: var(--text-main);
}

.folder-input-box:focus-within {
  border-color: var(--border-focus);
}

.pwd-input-box {
  flex: 1;
  min-width: 150px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pwd-input-box svg {
  color: #38bdf8;
}

.pwd-input-box input {
  color: #38bdf8;
}

.pwd-input-box:focus-within {
  border-color: #38bdf8;
}

/* 테라박스 동작 방식 선택기 */
.terabox-mode-row {
  margin-top: 10px;
  margin-bottom: 4px;
  padding: 10px 14px;
  background: rgba(14, 165, 233, 0.05);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.terabox-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.terabox-mode-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.terabox-mode-pills {
  display: flex;
  gap: 8px;
}

.mode-pill {
  cursor: pointer;
}

.mode-pill input[type="radio"] {
  display: none;
}

.mode-pill .pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: all 0.2s ease;
  user-select: none;
}

.mode-pill:hover .pill-btn {
  border-color: var(--text-muted);
  color: #fff;
}

.mode-pill input[type="radio"]:checked + .pill-btn {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.mode-pill input[type="radio"]:checked + .pill-btn.cloud {
  background: rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
  color: #e0f2fe;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.terabox-mode-desc {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding-left: 2px;
}

.badge-terabox-cloud {
  background: rgba(14, 165, 233, 0.2) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(14, 165, 233, 0.4) !important;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.save-path-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
  max-width: 580px;
}

.save-path-hint {
  font-size: 0.78rem;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-path-hint svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #818cf8;
}

.save-path-hint span {
  color: var(--text-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.storage-info-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-sub);
}

.storage-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.storage-stat-pill .storage-icon {
  font-size: 0.75rem;
  line-height: 1;
}

.storage-stat-pill .storage-label {
  color: var(--text-sub);
}

.storage-stat-pill .storage-val {
  color: #38bdf8;
  font-weight: 600;
}

.storage-stat-pill .storage-sub {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.storage-stat-pill.folder .storage-val {
  color: #a78bfa;
}

.storage-mini-meter {
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.storage-meter-fill {
  height: 100%;
  background: var(--status-green);
  border-radius: 999px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

.storage-meter-fill.warning {
  background: var(--status-yellow);
}

.storage-meter-fill.danger {
  background: var(--status-red);
}

.storage-percent-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.submit-btn {
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
  margin-left: auto;
}

.submit-btn svg {
  width: 18px;
  height: 18px;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

/* 탭 메뉴 */
.jobs-card {
  padding: 18px 22px;
}

.jobs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

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

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

.btn-clear-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear-action svg {
  width: 14px;
  height: 14px;
}

.btn-clear-action:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
}

.btn-clear-action.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.btn-clear-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.tab-count {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* 작업 카드 리스트 */
.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 180px;
}

.job-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.job-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-sm);
}

/* 1. 상단 태그 그룹 & 액션 버튼 행 */
.job-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.job-badges-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.job-service-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.job-mode-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.job-mode-tag.auto {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.job-mode-tag.manual {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.job-resume-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.job-folder-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-folder-tag.cloud {
  background: rgba(14, 165, 233, 0.15) !important;
  color: #38bdf8 !important;
  border-color: rgba(14, 165, 233, 0.3) !important;
}

.job-source-row {
  width: 100%;
  display: flex;
  align-items: center;
  margin-top: 2px;
  margin-bottom: 2px;
  min-width: 0;
}

.job-source-tag {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.32);
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.job-source-tag:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.5);
  color: #bae6fd;
}

.job-source-tag a {
  color: inherit;
  text-decoration: none;
  display: inline;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.job-source-tag a:hover {
  text-decoration: underline;
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.cloud-open-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  white-space: nowrap;
}

.cloud-open-btn:hover {
  background: rgba(14, 165, 233, 0.25);
  color: #e0f2fe;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.action-btn svg {
  width: 15px;
  height: 15px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--status-red);
  border-color: rgba(239, 68, 68, 0.4);
}

/* 2. 파일명 전용 행 */
.job-title-row {
  width: 100%;
}

.job-filename {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 프로그레스 바 */
.progress-bar-container {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-container.completed {
  opacity: 0.5;
  height: 4px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.completed {
  background: var(--status-green);
}

.progress-bar-fill.failed {
  background: var(--status-red);
}

.progress-bar-fill.indeterminate {
  width: 40% !important;
  animation: indeterminate 1.5s infinite linear;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* 작업 메타 정보 */
.job-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  gap: 8px;
  flex-wrap: wrap;
}

.job-meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.job-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.job-status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.job-bytes {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.job-speed {
  font-size: 0.76rem;
  color: var(--accent-primary);
  font-weight: 600;
  white-space: nowrap;
}

.job-eta {
  font-size: 0.76rem;
  color: var(--text-sub);
  white-space: nowrap;
}

.job-time {
  font-size: 0.74rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.time-icon {
  width: 12px;
  height: 12px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.status-queued { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.status-resolving { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; }
.status-downloading { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.status-paused { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.status-completed { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.status-failed { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.status-cancelled { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }

.job-error-text {
  font-size: 0.78rem;
  color: #f87171;
  word-break: break-all;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  background: rgba(239, 68, 68, 0.08);
  padding: 8px 11px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.job-error-header {
  font-weight: 700;
  color: #fca5a5;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.job-error-source {
  color: #fdba74;
}

.job-error-link {
  color: #93c5fd;
  text-decoration: underline;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: auto;
}

.job-error-detail {
  color: #f87171;
  font-size: 0.78rem;
  line-height: 1.4;
}

.btn-retry-mini {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: rgba(99, 102, 241, 0.22);
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #c7d2fe;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-retry-mini:hover {
  background: rgba(99, 102, 241, 0.45);
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.75);
}

.job-url-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  margin-top: 2px;
  min-width: 0;
  max-width: 100%;
}

.job-url-link {
  color: #94a3b8;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 32px);
}

.job-url-link:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.btn-copy-url,
.btn-copy-mini {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.3;
  transition: all 0.15s ease;
}

.btn-copy-url:hover,
.btn-copy-mini:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.job-error-link-row,
.job-error-source-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  min-width: 0;
  max-width: 100%;
}

.error-link-label {
  color: #fdba74;
  font-weight: 600;
  flex-shrink: 0;
}

.error-url-link {
  color: #93c5fd;
  text-decoration: underline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* 빈 상태 (Empty State) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  margin-bottom: 14px;
}

.empty-icon svg {
  width: 28px;
  height: 28px;
}

.empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 340px;
}

/* 모달 레이아웃 */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #141926;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: all 0.25s ease;
  overflow: hidden;
}

.modal-backdrop.show .modal {
  transform: translateY(0);
}

.modal-header {
  flex-shrink: 0;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-body.text-center {
  text-align: center;
}

.qr-guide {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.qrcode-container {
  display: inline-block;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.qrcode-container img {
  display: block;
}

.ip-urls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.ip-url-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #93c5fd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.ip-url-pill:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
}

.qr-subguide {
  font-size: 0.78rem;
  color: var(--text-sub);
}

/* 폼 그룹 */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 10px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-help {
  display: block;
  font-size: 0.74rem;
  color: var(--text-sub);
  margin-top: 4px;
}

.modal-actions {
  position: sticky;
  bottom: -22px;
  background: #141926;
  border-top: 1px solid var(--border-color);
  padding: 14px 0 2px 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  margin-bottom: -6px;
  z-index: 10;
}

.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

/* 토스트 알림 */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   반응형 모바일 최적화 (iPhone & 스마트폰 친화적 UI)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: 8px 10px;
  }

  .app-container {
    gap: 12px;
  }

  /* 1. 상단 헤더 컴팩트 최적화 */
  .header {
    padding: 6px 0;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  .header-brand {
    gap: 8px;
    min-width: 0;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .logo-icon svg {
    width: 18px;
    height: 18px;
  }

  .logo-title {
    font-size: 1.05rem;
    white-space: nowrap;
  }

  .logo-subtitle {
    display: none;
  }

  .header-actions {
    gap: 4px;
    margin-left: auto;
    align-items: center;
  }

  .server-status-pill {
    padding: 4px 7px;
    font-size: 0.72rem;
  }

  .user-pill {
    padding: 4px 7px;
    font-size: 0.72rem;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    padding: 6px;
    border-radius: var(--radius-sm);
  }

  .icon-btn svg {
    width: 16px;
    height: 16px;
  }

  /* 2. 실시간 통계 바: 모바일 3분할 슬림 그리드 */
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .stat-card {
    padding: 8px 4px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    border-radius: var(--radius-md);
    min-width: 0;
    overflow: hidden;
  }

  .stat-icon-wrapper {
    width: 26px;
    height: 26px;
    margin-bottom: 2px;
  }

  .stat-icon-wrapper svg {
    width: 13px;
    height: 13px;
  }

  .stat-info {
    min-width: 0;
    width: 100%;
  }

  .stat-label {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  .stat-value {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  /* 3. 새 다운로드 추가 카드 */
  .card {
    padding: 12px;
    border-radius: var(--radius-md);
  }

  .card-header {
    margin-bottom: 8px;
    gap: 6px;
  }

  .card-title {
    font-size: 0.95rem;
  }

  .service-badges {
    gap: 4px;
    width: 100%;
  }

  .badge {
    font-size: 0.68rem;
    padding: 2px 6px;
  }

  .badge-guide-btn {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
    padding: 6px;
    font-size: 0.75rem;
  }

  .url-textarea {
    font-size: 0.84rem;
    padding: 10px 10px 42px 10px;
    min-height: 105px;
  }

  .input-action-buttons {
    top: auto;
    bottom: 8px;
    right: 8px;
    gap: 4px;
  }

  .paste-btn,
  .input-action-buttons .paste-btn {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  /* 4. 서브폴더 & 비밀번호 입력창 세로 스택 */
  .sub-inputs-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .sub-inputs-row .sub-input-box,
  .folder-input-box,
  .pwd-input-box {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 9px 12px !important;
    box-sizing: border-box !important;
  }

  .terabox-mode-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .terabox-mode-pills {
    width: 100%;
    display: flex;
    gap: 6px;
  }

  .mode-pill {
    flex: 1;
  }

  .mode-pill .pill-btn {
    width: 100%;
    justify-content: center;
    padding: 7px 6px;
    font-size: 0.75rem;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .submit-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.95rem;
    order: 1;
  }

  .save-path-wrapper {
    max-width: 100%;
    order: 2;
    align-items: center;
    text-align: center;
  }

  .save-path-hint {
    font-size: 0.72rem;
    justify-content: center;
    max-width: 100%;
  }

  .storage-info-row {
    justify-content: center;
  }

  /* 5. 작업 목록 헤더 및 탭 모바일 최적화 */
  .jobs-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    width: 100%;
    padding-bottom: 2px;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 4px;
    font-size: 0.76rem;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
  }

  .tab-label-short {
    display: inline;
  }

  .tab-label-full {
    display: none;
  }

  .tab-count {
    font-size: 0.65rem;
    padding: 1px 4px;
  }

  .jobs-actions {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .btn-clear-action {
    flex: 1;
    justify-content: center;
    padding: 7px 4px;
    font-size: 0.74rem;
  }

  /* 6. 작업 카드 모바일 레이아웃 */
  .job-item {
    padding: 12px 10px;
    gap: 8px;
  }

  .job-header-row {
    align-items: flex-start;
    gap: 8px;
  }

  .job-badges-group {
    gap: 4px;
  }

  .job-folder-tag {
    max-width: 200px;
  }

  .job-source-row {
    margin-top: 0;
    margin-bottom: 2px;
    width: 100%;
  }

  .job-source-tag {
    max-width: 100% !important;
    white-space: normal !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    font-size: 0.73rem !important;
    line-height: 1.38 !important;
    padding: 3px 8px !important;
  }

  .job-filename {
    font-size: 0.9rem;
    line-height: 1.42;
    -webkit-line-clamp: 3;
    word-break: break-word;
  }

  .job-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .job-meta-left {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .job-meta-right {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .job-time {
    font-size: 0.7rem;
    padding: 1px 6px;
    margin-left: auto;
  }

  /* 7. 설정 그리드 모바일 단일 열 */
  .settings-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* 8. 설정 탭 네비게이션 가로 스와이프 */
  .settings-tab-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 8px;
    margin-bottom: 14px;
    width: 100%;
  }

  .settings-tab-bar::-webkit-scrollbar {
    display: none;
  }

  .settings-tab-btn {
    flex-shrink: 0;
    padding: 7px 11px;
    font-size: 0.78rem;
    gap: 4px;
  }

  .settings-card {
    padding: 12px !important;
    margin-bottom: 12px !important;
  }

  .aria2-split-wrapper {
    margin-left: 0 !important;
    margin-top: 6px !important;
    gap: 6px !important;
  }

  .settings-update-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 10px 12px !important;
  }

  .settings-update-vers {
    text-align: center;
    font-size: 0.82rem;
  }

  .settings-update-btns {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
  }

  .settings-update-btns button {
    flex: 1 !important;
    justify-content: center !important;
  }

  .kone-status-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .kone-status-bar button {
    width: 100% !important;
    justify-content: center !important;
  }

  .kone-watermark-actions {
    width: 100% !important;
    display: flex !important;
    gap: 6px !important;
  }

  .kone-watermark-actions button {
    flex: 1 !important;
    justify-content: center !important;
  }

  .kone-subfolder-label {
    margin-top: 0 !important;
  }

  .api-token-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .api-token-row input {
    width: 100% !important;
  }

  .api-token-actions {
    width: 100% !important;
    display: flex !important;
    gap: 6px !important;
  }

  .api-token-actions button {
    flex: 1 !important;
    justify-content: center !important;
  }

  .iphone-tab-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .iphone-tab-bar::-webkit-scrollbar {
    display: none;
  }

  .iphone-tab-bar .settings-subtab-btn {
    flex-shrink: 0;
  }

  .save-path-hint span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .storage-stat-pill {
    padding: 2px 6px;
    font-size: 0.68rem;
  }

  /* 9. 모달 창 화면 높이 및 터치 최적화 */
  .modal-backdrop {
    padding: 6px;
  }

  .modal {
    max-height: 94vh;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    margin: auto;
    width: 100% !important;
    max-width: 100% !important;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(94vh - 110px);
  }

  .modal-actions {
    position: sticky;
    bottom: -12px;
    background: #141926;
    border-top: 1px solid var(--border-color);
    padding: 12px 0 4px 0;
    display: flex;
    gap: 8px;
    z-index: 10;
  }

  .modal-actions button {
    flex: 1;
    justify-content: center;
    padding: 11px;
    font-size: 0.92rem;
    font-weight: 700;
  }

  /* iOS 사파리 폼 입력 포커스 시 화면 자동 확대 방지 */
  .form-input,
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 6px 8px;
  }

  .app-container {
    gap: 10px;
  }

  .header {
    padding: 4px 0;
  }

  .server-status-pill .status-text {
    display: none;
  }
  .server-status-pill {
    padding: 7px;
    border-radius: 50%;
  }
  .user-pill #currentUsernameText {
    display: none;
  }
  .user-pill {
    padding: 7px;
    border-radius: 50%;
  }
  .header-actions {
    gap: 3px;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .card {
    padding: 10px 8px;
  }

  .job-item {
    padding: 10px 8px;
    gap: 6px;
  }

  .job-service-tag,
  .job-mode-tag,
  .job-folder-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
  }

  .job-source-tag {
    font-size: 0.72rem !important;
    padding: 3px 7px !important;
  }

  .tab-btn {
    padding: 6px 2px;
    font-size: 0.73rem;
  }

  .btn-clear-action {
    padding: 6px 2px;
    font-size: 0.72rem;
  }
}

/* ==========================================
   설정 모달 탭 및 세련된 카드 레이아웃
   ========================================== */
.settings-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.settings-subtab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.settings-subtab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.settings-subtab-btn.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
}

.settings-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.settings-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.settings-tab-btn.active {
  color: #fff;
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  font-weight: 600;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
}

.settings-tab-pane {
  display: none;
  animation: fadeInSettingsPane 0.2s ease-out;
}

.settings-tab-pane.active {
  display: block;
}

@keyframes fadeInSettingsPane {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.settings-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.aria2-split-wrapper {
  margin-left: 24px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-update-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.settings-update-vers {
  font-size: 0.83rem;
}

.settings-update-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.cookie-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.kone-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  gap: 10px;
  flex-wrap: wrap;
}

.kone-watermark-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.kone-watermark-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

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

.api-token-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

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

.code-preview-row input {
  flex: 1;
  min-width: 0;
}

.code-preview-row button {
  flex-shrink: 0;
  white-space: nowrap;
}


/* ==========================================================================
   작업 목록 페이징 네비게이션
   ========================================================================== */

.jobs-pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-page-nav,
.btn-page-num {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-page-nav:hover:not(:disabled),
.btn-page-num:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn-page-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-page-num.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 12px var(--accent-glow);
}

.pagination-ellipsis {
  color: var(--text-sub);
  padding: 0 4px;
  font-size: 0.82rem;
}

.page-size-select {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.page-size-select:hover,
.page-size-select:focus {
  border-color: var(--accent-primary);
  color: var(--text-main);
}

@media (max-width: 640px) {
  .jobs-pagination-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .pagination-controls {
    width: 100%;
    justify-content: center;
  }
}


/* ============================================================
   본 프로그램 GitHub 릴리즈 최신 버전 알림 배너
   ============================================================ */
.app-update-banner {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.16) 0%, rgba(139, 92, 246, 0.14) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
  animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-update-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-update-badge {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.app-update-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-update-text strong {
  font-size: 0.92rem;
  color: #f1f5f9;
  font-weight: 600;
}

.app-update-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-update-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.app-update-link {
  font-size: 0.82rem;
  color: #93c5fd;
  text-decoration: none;
  transition: color 0.2s ease;
}

.app-update-link:hover {
  color: #bfdbfe;
  text-decoration: underline;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .app-update-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .app-update-actions {
    width: 100%;
    justify-content: space-between;
  }
}


/* ============================================================
   공통 유틸리티 클래스 (숨김 처리)
   ============================================================ */
.hidden {
  display: none !important;
}

.app-update-banner.hidden {
  display: none !important;
}
