:root {
  --bg-primary: #0f1117;
  --bg-secondary: #181b24;
  --bg-input: #181b24;
  --bg-card: #1f2330;
  --bg-card-hover: #262b3b;
  --border-color: #2e3447;
  --border-focus: #4f46e5;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.navbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 1.5rem;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

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

.status-dot.online {
  background-color: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.user-tag {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.queue-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(59, 130, 246, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

/* Tab Navigation */
.tabs-container {
  display: flex;
  gap: 0.5rem;
  background-color: var(--bg-secondary);
  padding: 0.5rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

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

/* Main Container */
.main-content {
  flex: 1;
  padding: 1.75rem;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
}

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

/* Studio Layout */
.studio-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.75rem;
}

@media (max-width: 1024px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}

select option,
select optgroup {
  background-color: var(--bg-card);
  color: var(--text-primary);
  padding: 0.5rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent-primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.file-upload-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.01);
  transition: all 0.2s;
}

.file-upload-box:hover {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.04);
}

.file-preview {
  max-width: 100%;
  max-height: 140px;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  display: none;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  width: 100%;
}

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

.btn-danger {
  background-color: var(--accent-danger);
  color: white;
}

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

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

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* Progress & Live Monitor */
.progress-bar-container {
  width: 100%;
  height: 12px;
  background-color: var(--bg-secondary);
  border-radius: 9999px;
  overflow: hidden;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  transition: width 0.3s ease;
}

.log-terminal {
  background-color: #0b0d13;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-family: monospace;
  font-size: 0.82rem;
  color: #a5b4fc;
  height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.4;
}

/* Gallery Layout */
.gallery-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  gap: 1rem;
}

.gallery-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.gallery-title-box h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.badge-gallery-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
}

.gallery-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Gallery View Mode Toggle */
.gallery-view-mode-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.gallery-view-mode-toggle .view-mode-btn {
  border-radius: 4px;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-view-mode-toggle .view-mode-btn:not(.active) {
  background: transparent;
  color: var(--text-secondary);
}

.gallery-view-mode-toggle .view-mode-btn.active {
  background: var(--accent-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Albums & Collections Horizontal Quick-Picker Ribbon */
.gallery-albums-ribbon {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.gallery-albums-ribbon-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
}

.gallery-albums-ribbon-list {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  flex: 1;
}

.gallery-albums-ribbon-list::-webkit-scrollbar {
  height: 4px;
}

.gallery-albums-ribbon-list::-webkit-scrollbar-track {
  background: transparent;
}

.gallery-albums-ribbon-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.gallery-album-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.gallery-album-pill:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
}

.gallery-album-pill.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #a5b4fc;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.25);
}

.album-pill-icon {
  font-size: 0.85rem;
}

.album-pill-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-pill-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.05rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.9;
}

/* Collections / Albums Card Grid View */
.gallery-albums-view-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.2s ease;
}

.gallery-albums-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.gallery-albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.gallery-album-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.gallery-album-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--accent-primary);
}

.gallery-album-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-album-cover img,
.gallery-album-cover video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.gallery-album-card:hover .gallery-album-cover img,
.gallery-album-card:hover .gallery-album-cover video {
  transform: scale(1.04);
}

.gallery-album-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 2.5rem;
  opacity: 0.5;
}

.gallery-album-badges-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 0.35rem;
  z-index: 2;
}

.gallery-album-badge-type {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gallery-album-rating-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(245, 158, 11, 0.9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.gallery-album-card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.gallery-album-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.gallery-album-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  word-break: break-word;
}

.gallery-album-card-path {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-album-stats-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  padding: 0.35rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-album-stat-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.gallery-album-tags-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 20px;
}

.gallery-album-tag-chip {
  font-size: 0.68rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.gallery-album-card-footer {
  margin-top: auto;
  padding-top: 0.4rem;
}

.gallery-album-open-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  cursor: pointer;
}

.gallery-album-card:hover .gallery-album-open-btn {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

/* Active Album Banner in Media Browser */
.gallery-active-album-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
  animation: fadeIn 0.2s ease;
}

.album-banner-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.album-banner-icon {
  font-size: 1.4rem;
}

.album-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.album-banner-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.gallery-list-album-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 0.3rem;
}

.gallery-list-album-badge:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

/* Gallery Dedicated Filter Panel */
.gallery-filter-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.gallery-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 180px;
}

.gallery-search-icon {
  position: absolute;
  left: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.gallery-search-input {
  width: 100%;
  padding: 0.42rem 0.75rem 0.42rem 2.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.gallery-search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  background: var(--bg-card);
}

.gallery-filter-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.gallery-filter-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.gallery-filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  white-space: nowrap;
  user-select: none;
}

.gallery-select {
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 90px;
}

.gallery-select:hover {
  border-color: var(--text-muted);
}

.gallery-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.gallery-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.gallery-filter-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-color);
  margin: 0 0.2rem;
}

.gallery-layout-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  align-items: start;
}

.gallery-sidebar-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  padding-right: 0.35rem;
}

.gallery-sidebar-container::-webkit-scrollbar {
  width: 6px;
}

.gallery-sidebar-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.gallery-sidebar-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.gallery-sidebar-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.gallery-media-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gallery-list-item {
  display: flex;
  gap: 0.85rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  align-items: center;
}

.gallery-list-item:hover {
  background-color: var(--bg-secondary);
  border-color: var(--accent-primary);
  transform: translateX(2px);
}

.gallery-list-item.active {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.gallery-list-thumb {
  position: relative;
  width: 120px;
  height: 68px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-list-thumb video,
.gallery-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.gallery-list-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 2px;
}

.gallery-list-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gallery-list-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.gallery-list-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.gallery-list-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Viewer Area */
.gallery-viewer-container {
  position: sticky;
  top: 1rem;
}

.gallery-active-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-player-wrapper {
  background-color: #000;
  min-height: 380px;
  max-height: 65vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.gallery-player-wrapper video {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  outline: none;
}

.gallery-player-wrapper img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
}

.gallery-active-meta {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
}

.gallery-active-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  word-break: break-all;
}

.gallery-active-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Rating and Tag Properties */
.gallery-active-props {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.gallery-prop-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.gallery-prop-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gallery-prop-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Star Rating Component */
.gallery-rating-stars {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.star-btn {
  background: none;
  border: none;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: #4b5563;
  padding: 0 1px;
  transition: transform 0.1s ease, color 0.15s ease, text-shadow 0.15s ease;
  user-select: none;
}

.star-btn:hover {
  transform: scale(1.22);
}

.star-btn.active,
.star-btn.hover-preview {
  color: #f59e0b;
  text-shadow: 0 0 6px rgba(245, 158, 11, 0.45);
}

.gallery-rating-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
}

.gallery-rating-badge.unrated {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
}

/* Tags Container & Pills */
.gallery-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 24px;
  align-items: center;
}

.gallery-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 9999px;
  transition: all 0.15s ease;
}

.gallery-tag-pill:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
}

.tag-remove-btn {
  background: none;
  border: none;
  color: #e0e7ff;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tag-remove-btn:hover {
  opacity: 1;
  color: var(--accent-danger);
  transform: scale(1.2);
}

/* Quick Tag Suggestions */
.gallery-tag-suggestions-wrapper {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.gallery-tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.gallery-tag-suggestion-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.gallery-tag-suggestion-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* Gallery List Item Badge Enhancements */
.gallery-list-rating-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: #f59e0b;
  font-size: 0.68rem;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: flex;
  align-items: center;
  gap: 2px;
}

.gallery-list-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.15rem;
}

.gallery-list-tag-chip {
  font-size: 0.65rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.gallery-active-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 960px) {
  .gallery-layout-container {
    grid-template-columns: 1fr;
  }
  .gallery-viewer-container {
    position: static;
  }
  .gallery-sidebar-container {
    max-height: 450px;
  }
  .gallery-filter-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .gallery-search-box {
    width: 100%;
    min-width: unset;
  }
  .gallery-filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
    width: 100%;
  }
  .gallery-filter-divider {
    display: none;
  }
  .gallery-filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
  .gallery-filter-group .gallery-select {
    width: 100%;
  }
}

.video-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.video-player-container {
  position: relative;
  width: 100%;
  background-color: #000;
  aspect-ratio: 16 / 9;
}

.video-player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-meta {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  word-break: break-all;
}

.video-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.video-actions {
  display: flex;
  gap: 0.5rem;
}

/* Login Modal */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 12, 18, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.login-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

/* Power LoRA Loader Styles */
.lora-section {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.lora-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.lora-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lora-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.lora-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s;
}

.lora-item:hover {
  border-color: rgba(99, 102, 241, 0.5);
}

.lora-item.disabled {
  opacity: 0.55;
}

.lora-toggle {
  cursor: pointer;
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
}

.lora-name-box {
  flex: 1;
  min-width: 0;
}

.lora-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.lora-strength-box {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lora-strength-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.lora-strength-input {
  width: 65px;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  text-align: center;
}

.lora-remove-btn {
  background: none;
  border: none;
  color: var(--accent-danger);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  opacity: 0.75;
  transition: opacity 0.15s;
  font-size: 0.9rem;
}

.lora-remove-btn:hover {
  opacity: 1;
}

.lora-add-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.lora-add-select {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color-scheme: dark;
}

.lora-add-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.lora-empty-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 12, 18, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-secondary);
}

.btn-icon-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.5rem;
  transition: color 0.2s;
}

.btn-icon-close:hover {
  color: var(--accent-danger);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.model-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.model-tag {
  background-color: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.model-tag.node-count {
  background-color: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
  color: #d8b4fe;
}

/* Flow Selector Bar & Tabs */
.flow-selector-bar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  background-color: var(--bg-secondary);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.flow-tab-btn {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

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

.flow-tab-btn.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.flow-tab-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.flow-tab-info {
  display: flex;
  flex-direction: column;
}

.flow-tab-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.flow-tab-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.flow-screen {
  display: none;
}

.flow-screen.active {
  display: block;
}

.resolution-inputs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.res-dim-input {
  max-width: 90px;
  text-align: center;
}

.res-dim-sep {
  color: var(--text-muted);
  font-weight: 600;
}

/* Media Picker Cards & Dropdowns */
.media-picker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.media-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.media-picker-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.media-picker-select-row {
  width: 100%;
}

.media-select-dropdown {
  width: 100%;
  font-size: 0.82rem;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  transition: border-color 0.15s;
  color-scheme: dark;
}

.media-select-dropdown option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.media-select-dropdown:hover, .media-select-dropdown:focus {
  border-color: var(--accent-primary);
  outline: none;
}

/* Custom Media Thumbnail Dropdowns */
.media-thumb-dropdown {
  position: relative;
  width: 100%;
}

.media-thumb-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  min-height: 42px;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.media-thumb-select-btn:hover {
  border-color: var(--accent-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.media-thumb-select-btn.open {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
  background-color: var(--bg-card);
}

.media-thumb-selected-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.media-thumb-placeholder-icon {
  font-size: 1.2rem;
  opacity: 0.85;
}

.media-thumb-btn-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-thumb-btn-preview {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 4px;
  overflow: hidden;
  background: #090b10;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  position: relative;
}

.media-thumb-btn-preview img,
.media-thumb-btn-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb-btn-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  line-height: 1.25;
  gap: 1px;
}

.media-thumb-btn-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-thumb-btn-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.media-thumb-btn-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.media-thumb-btn-clear {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  line-height: 1;
  display: none;
}

.media-thumb-select-btn.has-selection .media-thumb-btn-clear {
  display: inline-block;
}

.media-thumb-btn-clear:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.media-thumb-arrow {
  font-size: 0.65rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  user-select: none;
}

.media-thumb-select-btn.open .media-thumb-arrow {
  transform: rotate(180deg);
}

.media-thumb-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  max-height: 380px;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

.media-thumb-menu-header {
  padding: 0.45rem 0.55rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.media-thumb-search {
  flex: 1;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  outline: none;
}

.media-thumb-search:focus {
  border-color: var(--accent-primary);
}

.media-thumb-count-badge {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.media-thumb-items-list {
  overflow-y: auto;
  max-height: 320px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.media-thumb-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
}

.media-thumb-item:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}

.media-thumb-item.selected {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-primary);
}

.media-thumb-item.clear-option {
  border-bottom: 1px dashed var(--border-color);
  margin-bottom: 3px;
  padding-bottom: 0.5rem;
}

.media-thumb-item-icon {
  font-size: 1.25rem;
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.media-thumb-img-wrapper {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 4px;
  overflow: hidden;
  background: #080a0f;
  border: 1px solid var(--border-color);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-thumb-img-wrapper img,
.media-thumb-img-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb-video-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.55rem;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1;
}

.media-thumb-item-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.media-thumb-item-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-thumb-item-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.media-thumb-item-rating {
  color: #fbbf24;
  font-weight: 600;
}

.media-thumb-item-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.media-thumb-item-tag {
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.media-thumb-item-check {
  font-size: 0.9rem;
  color: var(--accent-primary);
  font-weight: bold;
  margin-left: auto;
  display: none;
}

.media-thumb-item.selected .media-thumb-item-check {
  display: block;
}

.media-thumb-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Media Upload Boxes for Reference Images & Pose Video */
.media-upload-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.upload-box {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.upload-box:hover, .upload-box.drag-over {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

.file-hidden-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.upload-box-content {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.upload-icon {
  font-size: 2rem;
  line-height: 1;
}

.upload-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 2px);
}

.upload-clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.upload-clear-btn:hover {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
  transform: scale(1.1);
}

.video-upload-box {
  min-height: 160px;
}

.upload-video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 6;
}

.upload-video-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-preview-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 8;
}

.video-preview-name {
  font-size: 0.75rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

/* -------------------------------------------------------------
   Live Generator Monitor: System Stats, Running Status, Queue Manager
   ------------------------------------------------------------- */

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.monitor-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* System Stats Grid */
.system-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}

@media (max-width: 768px) {
  .system-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .system-stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.2s, background 0.2s;
}

.stat-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(0, 0, 0, 0.35);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.stat-icon {
  font-size: 1rem;
}

.stat-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  white-space: nowrap;
}

.stat-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.stat-meter-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.stat-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  border-radius: 999px;
  transition: width 0.4s ease, background 0.3s;
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Current Running Panel */
.current-running-panel {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.running-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.running-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-idle {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  border-color: rgba(148, 163, 184, 0.2);
}

.status-running, .status-sampling {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.status-completed {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border-color: rgba(99, 102, 241, 0.4);
}

.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.status-interrupted {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
  border-color: rgba(245, 158, 11, 0.4);
}

.execution-timer {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
}

.active-item-details {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.active-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-workflow {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.badge-prompt-id {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.badge-job-num {
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--accent-warning);
}

.active-item-prompt {
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.35;
  max-height: 4.2em;
  overflow-y: auto;
  font-style: italic;
  border-left: 2px solid var(--accent-primary);
  padding-left: 0.5rem;
}

.current-node-box {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

/* Queue Manager Section */
.queue-manager-section {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.queue-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.queue-manager-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.queue-tab-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 2px;
}

.queue-tab-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.queue-tab-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.queue-tab-pill.active {
  background: var(--accent-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
}

.queue-count-sub {
  font-size: 0.7rem;
  opacity: 0.85;
}

.queue-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.queue-export-select {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.75rem;
  max-width: 220px;
}

.btn-toggle-queue {
  font-weight: 500;
}

.queue-collapsible-wrapper {
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.3s ease;
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
}

.queue-collapsible-wrapper.is-collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin: 0 !important;
  pointer-events: none;
}

.queue-count-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.queue-items-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.queue-empty-msg {
  text-align: center;
  padding: 1.25rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
}

.queue-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  transition: border-color 0.2s, background 0.2s;
}

.queue-item-card.is-running {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.queue-item-card.is-saved {
  border-color: rgba(255, 255, 255, 0.07);
}

.queue-item-card.is-saved:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.03);
}

.queue-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.queue-item-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.queue-item-pos {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.queue-item-card.is-running .queue-item-pos {
  background: var(--accent-success);
  color: #000;
}

.queue-item-prompt-preview {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}

.queue-item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.queue-btn-delete {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.queue-btn-delete:hover {
  background: var(--accent-danger);
  color: #fff;
}

.queue-btn-enqueue {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Role and Status Badges */
.badge-role {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.badge-role-admin {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.badge-role-user {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  line-height: 1;
}

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

.badge-status-active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

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

.badge-status-disabled::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
}

/* Alert Box */
.alert-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Profile Tab Layout */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 768px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

.profile-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.profile-info-grid {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0;
}

.profile-avatar-box {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.profile-meta-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.profile-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.4rem;
}

.profile-meta-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.profile-meta-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* User Management Layout */
.admin-users-container {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.admin-users-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.users-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.users-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.users-table tbody tr {
  transition: background-color 0.15s ease;
}

.users-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.users-table tbody tr.is-disabled {
  opacity: 0.6;
}

.user-cell-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.user-cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-action {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-action-disable {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-action-disable:hover:not(:disabled) {
  background: #ef4444;
  color: #fff;
}

.btn-action-enable {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.btn-action-enable:hover:not(:disabled) {
  background: #10b981;
  color: #fff;
}

.btn-action-reset {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.btn-action-reset:hover {
  background: #f59e0b;
  color: #000;
}

.btn-action-delete {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.btn-action-delete:hover:not(:disabled) {
  background: #ef4444;
  color: #fff;
}

.btn-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
