:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #1e293b;
  --border-color: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Navbar */
.navbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.logo-icon {
  font-size: 2rem;
}

.nav-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.subtitle {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.badge {
  background-color: var(--border-color);
  color: #38bdf8;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  background-color: rgba(51, 65, 85, 0.5);
  border: 1px solid var(--border-color);
}

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

.status-pill.running .dot, .status-pill.syncing .dot {
  background-color: var(--accent-warning);
  box-shadow: 0 0 8px var(--accent-warning);
  animation: pulse 1.5s infinite;
}

.status-pill.paused .dot {
  background-color: #f97316;
}

.status-pill.success .dot, .status-pill.idle .dot {
  background-color: var(--accent-success);
}

.status-pill.error .dot, .status-pill.cancelled .dot {
  background-color: var(--accent-danger);
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-warning {
  background-color: #d97706;
  color: #fff;
}
.btn-warning:hover {
  background-color: #b45309;
}

.btn-danger {
  background-color: #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: #475569;
}

/* Container */
.container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  flex: 1;
}

/* Two-Column Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-column {
    position: static !important;
  }
}

.main-column {
  min-width: 0; /* Prevents flex/grid blowouts with tables */
}

.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 1rem;
}

/* Channel Bar & Switcher Tabs */
.channel-bar {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.85));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.channel-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.channel-bar-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.channel-active-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}

.channel-tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.channel-tab {
  flex: 1;
  min-width: 150px;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-align: left;
}

.channel-tab:hover {
  background-color: rgba(51, 65, 85, 0.5);
  color: #fff;
  border-color: #475569;
}

.channel-tab.active {
  background-color: rgba(37, 99, 235, 0.2);
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.channel-tab[data-channel="6428758"].active {
  background-color: rgba(220, 38, 38, 0.18);
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.channel-tab[data-channel="all"].active {
  background-color: rgba(147, 51, 234, 0.2);
  border-color: #a855f7;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.25);
}

.channel-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.channel-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.channel-id-tag {
  font-size: 0.7rem;
  font-family: monospace;
  color: #94a3b8;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.channel-count-pill {
  margin-left: auto;
  font-size: 0.75rem;
  font-family: monospace;
  font-weight: 600;
  background-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}

.channel-tab.active .channel-count-pill {
  background-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Catalog Header & Filter Tabs */
.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-tabs {
  display: inline-flex;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.25rem;
  gap: 0.25rem;
}

.filter-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.filter-tab:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}

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

.tab-count {
  background-color: rgba(255, 255, 255, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-family: monospace;
}

.filter-tab.active .tab-count {
  background-color: rgba(0, 0, 0, 0.25);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Sidebar Cards */
.sidebar-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.15rem;
}

.sidebar-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}

.sidebar-card-header h3 {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 700;
}

.status-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.status-tag.running, .status-tag.syncing {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  animation: pulse 1.5s infinite;
}

.status-tag.paused {
  background-color: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

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

.status-tag.error, .status-tag.cancelled {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Sidebar Download Progress Card */
.progress-side-card {
  border-left: 4px solid var(--accent-primary);
  background: linear-gradient(145deg, #1e293b, #0f172a);
}

.sidebar-progress-label {
  font-size: 0.68rem;
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.progress-side-card .progress-filename {
  font-size: 0.88rem;
  color: #fff;
  font-weight: 600;
  margin: 0.25rem 0 0.6rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  font-family: monospace;
}

.progress-pct {
  font-weight: 700;
  color: #38bdf8;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

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

.channel-progress-card {
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.channel-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.channel-progress-header .channel-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
}

.channel-progress-pct {
  font-family: monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
}

.channel-progress-file {
  font-size: 0.78rem;
  color: #e2e8f0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.35rem;
}

.progress-bar-fill.zh {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.progress-bar-fill.en {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.sidebar-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* Sidebar Storage Stats */
.sidebar-stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.825rem;
}

.stat-name {
  color: #94a3b8;
}

.stat-num {
  color: #fff;
  font-weight: 600;
  font-family: monospace;
}

.stat-num.highlighted {
  color: #38bdf8;
  font-weight: 700;
}

.stat-code {
  font-family: monospace;
  font-size: 0.75rem;
  color: #cbd5e1;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-badge {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.sidebar-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Recent Files Card */
.recent-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 290px;
  overflow-y: auto;
}

.recent-file-item {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  transition: background-color 0.15s;
}

.recent-file-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.recent-file-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-file-meta {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.2rem;
  display: flex;
  justify-content: space-between;
}

.recent-file-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.empty-recent {
  text-align: center;
  color: #64748b;
  font-size: 0.8rem;
  padding: 1.25rem 0;
}

/* Badges for online media */
.badge-online {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  background-color: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-pending {
  background-color: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.btn-download-action {
  background-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

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

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  font-size: 2rem;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 0.6rem;
  border-radius: 8px;
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}

.stat-value-sub {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sticky Player Banner */
.player-banner {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid #3b82f6;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.player-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.player-info {
  flex: 1;
  min-width: 250px;
}

.now-playing-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.1em;
}

.player-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

audio {
  flex: 1;
  min-width: 280px;
  height: 38px;
}

.btn-close-player {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}
.btn-close-player:hover {
  color: #fff;
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 450px;
}

.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.search-box input {
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem 0.6rem 2.4rem;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}
.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

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

/* Toolbar Controls */
.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.toolbar-control-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.toolbar-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.toolbar-select:focus {
  border-color: var(--accent-primary);
}

/* Table */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

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

.sermon-table th {
  background-color: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Sortable Headers */
.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, color 0.15s;
}

.th-sortable:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #fff !important;
}

.th-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sort-icon {
  font-size: 0.75rem;
  color: #64748b;
  transition: color 0.15s, transform 0.15s;
}

.sort-icon.active {
  color: var(--accent-primary);
  font-weight: 700;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background-color: rgba(15, 23, 42, 0.6);
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-page {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-page:hover:not(:disabled) {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-primary);
  color: #fff;
}

.btn-page.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.btn-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.page-ellipsis {
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 0 0.2rem;
}

.sermon-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  vertical-align: middle;
}

.sermon-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.sermon-title-cell {
  font-weight: 600;
  color: #fff;
}

.series-pill {
  display: inline-block;
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.speaker-label {
  color: #cbd5e1;
}

.media-tag-group {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.media-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

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

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

.media-badge.missing {
  background-color: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Channel Badges in Table */
.channel-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

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

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


.action-btns {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-icon-action {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.15s;
}

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

.loading-cell {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

/* Forms & Settings */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #e2e8f0;
}

.form-control {
  width: 100%;
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  line-height: 1.4;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(3px);
}

.modal-dialog {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 1001;
}

.modal-video {
  max-width: 900px;
}

.video-modal-body {
  padding: 0.5rem;
  background-color: #000;
}

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

.modal-header h2 {
  font-size: 1.15rem;
  color: #fff;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
}

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

.log-viewer {
  background-color: #090d16;
  color: #38bdf8;
  padding: 1rem;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 55vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 0.8rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.footer code {
  color: #38bdf8;
}

.hidden {
  display: none !important;
}
