/* === video-to-url v6.0 (Stable) ===
   Locked at 2026-07-04
   DO NOT MODIFY without version bump
*/
/* sp-tool v5.4 设计系统（加大加粗） — 柔和渐变胶囊风格 — 2026-07-02 */

/* ========== Design Tokens ========== */
:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #818CF8;
  --primary-50: #EEF2FF;
  --primary-100: #E0E7FF;
  --primary-200: #C7D2FE;
  --primary-300: #A5B4FC;

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-50: #FEF2F2;
  --danger-100: #FEE2E2;

  --success: #10B981;
  --success-50: #ECFDF5;

  --warning: #F59E0B;
  --warning-50: #FFFBEB;

  --info: #06B6D4;
  --info-50: #ECFEFF;

  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --bg: linear-gradient(135deg, #F7F6FB 0%, #F4F3F8 100%);
  --bg-solid: #F5F3FF;
  --card-bg: #FAFAFC;
  --row-alt-bg: #F5F7FB;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.06);

  --text: #1E1B4B;
  --text-secondary: #4338CA;
  --text-muted: #6B7280;
  --text-light: #71717A;
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(99,102,241,0.1);
  --shadow-lg: 0 8px 24px rgba(99,102,241,0.12);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Dark Theme ========== */
[data-theme="dark"] {
  --primary: #818CF8;
  --primary-hover: #6366F1;
  --primary-hover: #6366F1;
  --primary-light: #A5B4FC;
  --primary-50: #1E1B4B;
  --primary-100: #312E81;
  --primary-200: #3730A3;
  --primary-300: #4338CA;

  --danger: #F87171;
  --danger-hover: #EF4444;
  --danger-50: #450A0A;
  --danger-100: #7F1D1D;

  --success: #34D399;
  --success-50: #064E3B;

  --warning: #FBBF24;
  --warning-50: #451A03;

  --info: #22D3EE;
  --info-50: #083344;

  --gray-50: #1E1E2E;
  --gray-100: #252535;
  --gray-200: #2D2D44;
  --gray-300: #3D3D55;
  --gray-400: #5A5A7A;
  --gray-500: #7878A0;
  --gray-600: #9A9AB8;
  --gray-700: #BCBCD4;
  --gray-800: #DEDEEC;
  --gray-900: #F0F0F8;

  --bg: linear-gradient(135deg, #0F0F1A 0%, #141423 30%, #0D1117 70%, #0F0F1A 100%);
  --bg-solid: #0F0F1A;
  --card-bg: #1A1A2E;
  --row-alt-bg: #202038;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.4);

  --text: #E2E2EA;
  --text-secondary: #A5B4FC;
  --text-muted: #9CA3AF;
  --text-light: #52525B;
  --border: #2D2D44;
  --border-light: #1E1E2E;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(99,102,241,0.15);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--ease) 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--primary-100);
  transform: scale(1.1);
}

/* Theme transition: smooth color switching */
body, .header, .card, .tabs, .tab, tbody td, thead th, .drop-zone,
.modal-card, .empty-state, .filter-select, .search-input, .pg-btn,
.queue-item, .spinner-wrap, input, select {
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

/* Dark mode adjustments for specific elements */
[data-theme="dark"] .header {
  background: rgba(26, 26, 46, 0.85);
}
[data-theme="dark"] .tabs {
  background: rgba(26, 26, 46, 0.5);
}
[data-theme="dark"] .tab.active {
  background: var(--card-bg);
  color: var(--primary);
}
[data-theme="dark"] tbody td {
  background: var(--card-bg);
}
[data-theme="dark"] tbody tr:nth-child(even) td {
  background: var(--gray-50);
}
[data-theme="dark"] tbody tr:hover td {
  background: var(--primary-50) !important;
}
[data-theme="dark"] .login-card input,
[data-theme="dark"] .modal-card input,
[data-theme="dark"] .modal-card select {
  background: var(--gray-100);
  color: var(--text);
}
[data-theme="dark"] .result-url {
  background: var(--gray-100);
  color: var(--text);
}
[data-theme="dark"] .small-url {
  background: var(--gray-100);
  color: var(--gray-600);
}
[data-theme="dark"] .copy-btn-sm {
  background: var(--gray-100);
  color: var(--gray-500);
}
[data-theme="dark"] .pg-btn {
  background: var(--card-bg);
  color: var(--text);
}
[data-theme="dark"] .drop-zone {
  background: linear-gradient(135deg, var(--primary-50), var(--gray-100));
}


/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { min-height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-solid);
  background-image: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== Login ========== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-solid);
  background-image: var(--bg);
  background-attachment: fixed;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo { width: 56px; height: 56px; margin-bottom: 12px; border-radius: var(--radius-md); }
.login-card h1 { font-size: 23px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.login-desc { color: var(--text-muted); margin-bottom: 28px; font-size: 15px; }

.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  outline: none;
  transition: all var(--ease) 0.2s;
  margin-bottom: 12px;
  background: var(--gray-50);
  color: var(--text);
}
.login-card input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-100);
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--danger-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger-100);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease) 0.2s;
  gap: 6px;
  letter-spacing: 0.2px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 2px 6px rgba(99,102,241,0.25);
}
.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--primary-50);
  color: var(--primary);
}

.btn-block { width: 100%; }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: all var(--ease) 0.15s;
  color: var(--gray-400);
}
.btn-icon:hover {
  background: var(--primary-50);
  color: var(--primary);
}
.btn-icon.btn-icon-danger:hover {
  background: var(--danger-50);
  color: var(--danger);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}

/* ========== App Layout ========== */
.app { min-height: 100vh; }

.header {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header h1 {
  font-size: 19px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.header-logo {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ========== User Badge ========== */
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.user-badge .avatar-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.badge-role {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.badge-role.admin { background: var(--warning-50); color: #92400E; }
.badge-role.uploader { background: var(--primary-50); color: var(--primary); }
.badge-role.h5_uploader { background: var(--success-50); color: #065F46; }

/* ========== Tabs ========== */
.tabs-wrap {
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 0 24px;
}
.tabs {
  display: flex;
  gap: 6px;
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  padding: 4px;
  overflow-x: auto;
}
.tab {
  padding: 9px 18px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--ease) 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: var(--gray-100);
  color: var(--gray-400);
  font-size: 12px;
  border-radius: var(--radius-full);
  margin-left: 4px;
  padding: 0 5px;
  font-weight: 600;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.tab-panel { animation: fadeSlide 0.25s var(--ease); }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Cards ========== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--ease) 0.2s;
}
.card:hover {
  box-shadow: var(--card-shadow-hover);
}
.main .card + .card { margin-top: 20px; }
.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* ========== Drop Zone ========== */
.drop-zone {
  border: 1.5px dashed var(--primary-200);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--ease) 0.2s;
  background: linear-gradient(135deg, #F0F0F8, #F8F8FC);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-50);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.06);
}
.drop-zone-icon { color: var(--primary-300); margin-bottom: 12px; }
.drop-zone-text { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.drop-zone-text .link { color: var(--primary); font-weight: 600; }
.drop-zone-hint { font-size: 13px; color: var(--primary-300); }

/* ========== Progress ========== */
.progress-section { margin-top: 20px; }
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}
.progress-fill.error { background: linear-gradient(90deg, var(--danger), #FCA5A5); }
.progress-fill.processing {
  background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.upload-status { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ========== Result URL ========== */
.result-section { margin-top: 20px; }
.result-label { font-size: 14px; font-weight: 600; color: var(--success); margin-bottom: 8px; }
.result-url-row { display: flex; gap: 10px; }
.result-url {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--gray-50);
  outline: none;
  font-family: var(--font-mono);
}
.result-url:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.copy-tip { font-size: 13px; color: var(--success); margin-top: 6px; }

/* ========== Small URL (table cells) ========== */
.small-url {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--gray-50);
  cursor: pointer;
  text-align: right !important;
  direction: ltr;
}
.small-url:focus { border-color: var(--primary); outline: none; }

.cell-url-row { display: flex; align-items: center; gap: 4px; }
.cell-url-row .small-url { flex: 1; min-width: 0; }
.copy-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.2s;
  color: var(--text-muted);
  font-weight: 600;
}
.copy-btn-sm:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.copy-btn-sm.copied { background: var(--success); color: #fff; border-color: var(--success); }

.btn-copy-accent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease) 0.2s;
}
.btn-copy-accent:hover { background: var(--primary); color: #fff; }
.btn-copy-accent.copied { background: var(--success); color: #fff; border-color: var(--success); }

/* ========== Tables ========== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0.3px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  background: var(--card-bg);
}

tbody tr:last-child td { border-bottom: none; }

/* Zebra striping */
tbody tr:nth-child(even) td { background: var(--row-alt-bg); }

/* Row hover */
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover td {
  background: var(--primary-50) !important;
}

.td-name { max-width: 180px; font-weight: 600; }
.td-url { max-width: 260px; }
.td-user { font-weight: 600; }
.td-nickname { white-space: nowrap; }

.url-link {
  color: var(--primary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
}
.url-link:hover { text-decoration: underline; }
.td-size { white-space: nowrap; color: var(--text-muted); }
.td-time { white-space: nowrap; color: var(--text-muted); }
.td-actions { white-space: nowrap; }

/* ========== Sortable Headers ========== */
thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
thead th.sortable:hover { color: var(--primary); }
thead th.sortable.sorted { color: var(--primary); }

/* ========== iOS 风格设置页 ========== */
.ios-settings {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 0 40px;
}
.ios-group-title {
  font-size: 13px;
  color: var(--text-muted);
  margin: 22px 16px 8px;
  font-weight: 600;
}
.ios-group {
  background: var(--card-bg);
  border-radius: 12px;
  margin: 0 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
#otaHistory{max-height:260px;overflow-y:auto}
.ios-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  min-height: 48px;
}
.ios-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}
.ios-row-label {
  font-size: 15px;
  color: var(--text);
  flex-shrink: 0;
}
.ios-row-label small {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 2px;
}
.ios-row-value {
  font-size: 15px;
  color: var(--text-muted);
  text-align: right;
  word-break: break-all;
}
.ios-row-col {
  flex-direction: column;
  align-items: stretch;
}
.ios-row-col > .ios-row-label {
  margin-bottom: 10px;
}
.ios-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: transparent;
  color: var(--text);
}
.ios-input:focus { border-color: var(--primary); }
.ios-file {
  width: 100%;
  font-size: 13px;
  color: var(--text-muted);
}
.ios-file-label {
  display: inline-block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.ios-row-action {
  gap: 12px;
}
.ota-publish {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.ota-field { display: flex; flex-direction: column; }
.ota-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.ota-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s ease;
}
.ota-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}
.ota-msg {
  font-size: 13px;
  color: var(--success);
}
.ota-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--gray-50, #f7f8fa);
  border: 1px solid var(--gray-200, #eef0f3);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 8px;
}
.ota-file-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 6px 0 2px;
  word-break: break-all;
}
.ota-policy {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}
.ota-dl {
  font-size: 12.5px;
  color: var(--primary);
  text-decoration: none;
  margin-left: 10px;
}
.ota-dl:hover { text-decoration: underline; }
.badge-current {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--success, #2ecc71);
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
}
.sort-ic { font-size: 12px; margin-left: 2px; color: var(--primary); }
.sort-ic.dim { opacity: 0.2; }

/* ========== Pagination ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  font-size: 14px;
}
.pg-info { color: var(--text-muted); white-space: nowrap; }
.pg-list { display: flex; gap: 3px; align-items: center; }
.pg-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pg-btn:hover { background: var(--primary-50); border-color: var(--primary-200); }
.pg-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pg-btn.disabled, .pg-btn[disabled] { opacity: 0.4; cursor: default; pointer-events: none; }
.pg-dots { padding: 0 4px; color: var(--gray-400); font-size: 15px; }

/* ========== Search Input ========== */
.search-input {
  width: 240px;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") 12px center no-repeat;
  transition: all 0.2s;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}
.search-input::placeholder { color: var(--gray-400); }

/* ========== Header Controls ========== */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  min-height: 32px;
}
.history-header h2 { margin-bottom: 0; }

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 15px;
  background: rgba(255,255,255,0.5);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--gray-200);
}
.empty-state-icon { font-size: 49px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.empty-state-hint { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }

/* ========== Modal ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30,27,75,0.4);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  z-index: 1;
  animation: slideUp 0.25s var(--ease);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.modal-card h3 { font-size: 19px; font-weight: 600; margin-bottom: 20px; color: var(--text); }
.modal-card label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
  margin-top: 14px;
}
.modal-card label:first-of-type { margin-top: 0; }
.modal-card label small { font-weight: 600; color: var(--gray-400); }
.modal-card input, .modal-card select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
  margin-top: 2px;
  background: var(--gray-50);
  color: var(--text);
}
.modal-card input:focus, .modal-card select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-100);
}
.modal-card p { font-size: 15px; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-card .error-msg { margin-top: 10px; }

/* ========== Delete Confirm ========== */
#deleteConfirmMsg { font-size: 16px; line-height: 1.8; color: var(--text); }
#deleteConfirmMsg .hl { color: var(--danger); font-weight: 700; }
#deleteConfirmMsg code {
  background: var(--danger-50);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--danger);
  font-size: 14px;
}
#deleteConfirmMsg small { color: var(--gray-400); font-size: 14px; display: block; margin-top: 6px; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-800);
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  opacity: 0;
  transition: all var(--ease) 0.3s;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ========== Filter Select ========== */
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 110px;
  box-shadow: var(--shadow-sm);
}
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }

/* ========== Role Edit Select ========== */
.role-edit-select {
  padding: 5px 10px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.role-edit-select:focus { box-shadow: 0 0 0 3px var(--primary-100); }

/* ========== Button Group Compact ========== */
.btn-group-compact {
  display: flex;
  gap: 2px;
  align-items: center;
}
.btn-group-compact .btn-icon {
  padding: 4px 8px;
  font-size: 14px;
  opacity: 0.65;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.btn-group-compact .btn-icon:hover { opacity: 1; }
.btn-group-compact .btn-icon.btn-icon-danger { opacity: 0.55; }
.btn-group-compact .btn-icon.btn-icon-danger:hover {
  opacity: 1;
  background: var(--danger-50);
  color: var(--danger);
}

.btn-text {
  font-size: 12px;
  font-weight: 600;
  margin-left: 3px;
  letter-spacing: 0.2px;
}

/* ========== Batch Upload Queue ========== */
.batch-summary { font-size: 15px; color: var(--text-secondary); margin-bottom: 12px; }
.queue-list { display: flex; flex-direction: column; gap: 10px; }
.queue-item { background: var(--gray-50); border-radius: var(--radius-md); padding: 10px 14px; border: 1px solid var(--border-light); }
.queue-list .queue-item:nth-child(even) { background: var(--row-alt-bg); }
.qi-info { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.qi-name { flex: 1; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-size { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.qi-status { font-size: 13px; white-space: nowrap; min-width: 80px; text-align: right; }
.qi-bar { height: 6px; background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; }
.qi-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: var(--radius-full); transition: width .2s; }
.queue-done .qi-fill { background: var(--success); }
.queue-done .qi-status { color: var(--success); }
.queue-error .qi-fill { background: var(--danger); }
.queue-error .qi-status { color: var(--danger); }

.queue-list.fading-out {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  transition: opacity 0.5s, max-height 0.5s 0.3s, margin 0.5s 0.3s, padding 0.5s 0.3s;
  overflow: hidden;
}

/* ========== Spinner ========== */
.spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--primary-100);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-text {
  margin-left: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ========== Shake ========== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.shake { animation: shake 0.4s var(--ease); }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .login-card { padding: 32px 24px; }
  .main { padding: 16px; }
  .card { padding: 20px; }
  .drop-zone { padding: 32px 16px; }
  .result-url-row { flex-direction: column; }
  .header-inner { padding: 12px 16px; }
  .header h1 { font-size: 16px; }
  .header-right { gap: 6px; }
  .td-url { max-width: 160px; }
  .tabs-wrap { padding: 0 16px; }
  .tabs { padding: 3px; }
  .tab { padding: 8px 14px; font-size: 13px; }
  .search-input { width: 120px; }
  .search-input:focus { width: 150px; }
  .header-controls { flex-wrap: wrap; }
  .pagination { flex-direction: column; gap: 8px; align-items: center; }
}

/* Stats Modal close button */
.modal-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
}
.modal-close-x:hover {
  background: var(--primary-bg);
  color: var(--primary);
}
[data-theme="dark"] .modal-close-x:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
