/**
 * OCR Farm Dashboard v2 - Professional Ergonomic Design System
 * Modern sidebar + tabs layout optimized for 40+ profiles
 */

/* ============================================
   TEXT SELECTION — allow everywhere by default
   ============================================ */
* {
  user-select: text;
  -webkit-user-select: text;
}

/* Disable selection only on purely interactive elements (no readable text) */
button,
.btn,
.sidebar-nav-item,
.tab,
.tab-btn,
input[type="checkbox"],
input[type="radio"],
input[type="range"],
select,
svg,
.toggle-switch,
.icon-btn,
.btn-icon,
.badge,
.status-indicator {
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */

:root {
  /* Color Palette - Professional Dark Theme */
  --color-bg-primary: #0a0f1a;
  --color-bg-secondary: #111827;
  --color-bg-tertiary: #1f2937;
  --color-bg-elevated: #374151;
  --color-bg-hover: #4b5563;

  /* Accent Colors */
  --color-accent: #3b82f6;
  --color-accent-hover: #2563eb;
  --color-accent-light: #60a5fa;
  --color-accent-glow: rgba(59, 130, 246, 0.4);

  /* Status Colors */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-error: #ef4444;
  --color-error-bg: rgba(239, 68, 68, 0.15);
  --color-info: #06b6d4;
  --color-info-bg: rgba(6, 182, 212, 0.15);
  --color-idle: #6b7280;
  --color-idle-bg: rgba(107, 114, 128, 0.15);

  /* Text Colors */
  --color-text-primary: #f9fafb;
  --color-text-secondary: #d1d5db;
  /* Improved from #9ca3af */
  --color-text-tertiary: #9ca3af;
  /* Improved from #6b7280 */
  --color-text-muted: #4b5563;

  /* Borders */
  --color-border: #374151;
  --color-border-light: #4b5563;
  --color-border-focus: #3b82f6;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--color-accent-glow);

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Monaco", monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --header-height: 64px;
  --profile-card-min: 280px;

  /* Semantic Colors */
  --color-card: var(--color-bg-secondary);
}

/* ============================================
   BASE STYLES
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   LAYOUT STRUCTURE
   ============================================ */

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: auto 1fr;
  /* Allow header to expand */
  min-height: 100vh;
  transition: grid-template-columns var(--transition-slow);
}

.app-layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  grid-row: 1 / -1;
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 100;
  transition: width var(--transition-slow);
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-height: var(--header-height);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-info));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-title {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: var(--spacing-md) var(--spacing-sm);
  overflow-y: auto;
}

.nav-section {
  margin-bottom: var(--spacing-lg);
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  padding: var(--spacing-xs) var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
}

.sidebar-collapsed .nav-section-title {
  display: none;
}

.quick-status {
  padding: 8px 12px;
}

.quick-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.quick-status-icon {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: none;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.quick-status-icon-success {
  background: var(--color-success);
}

.quick-status-icon-warning {
  background: var(--color-warning);
}

.quick-status-icon-error {
  background: var(--color-error);
}

.quick-status-icon-info {
  background: var(--color-info);
}

.quick-status-label {
  font-size: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
}

.nav-item:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.nav-item.active {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
  font-weight: 600;
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item-text {
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsed .nav-item-text {
  display: none;
}

.nav-item-badge {
  margin-left: auto;
  background: var(--color-accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-collapsed .nav-item-badge {
  position: absolute;
  right: -4px;
  top: -4px;
  font-size: 10px;
  min-width: 16px;
  padding: 1px 4px;
}

.sidebar-collapsed .quick-status {
  padding: 8px 6px;
}

.sidebar-collapsed .quick-status-label {
  display: none;
}

.sidebar-collapsed .quick-status-row {
  justify-content: center;
  gap: 6px;
}

.sidebar-collapsed .quick-status-count {
  width: auto;
  text-align: center;
  font-size: 12px;
}

.sidebar-collapsed .quick-status-icon {
  display: inline-block;
}

.sidebar-footer {
  padding: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

.sidebar-toggle {
  width: 100%;
  padding: var(--spacing-sm);
  background: var(--color-bg-tertiary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
}

/* ============================================
   HEADER
   ============================================ */

.header {
  grid-column: 2;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-lg);
  gap: var(--spacing-lg);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-height);
  padding-top: 4px;
  /* Ensure content spacing */
  padding-bottom: 4px;
}

/* Stats Bar V2 Removed (Unused) */

.header-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-left: auto;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  grid-column: 2;
  padding: var(--spacing-lg);
  min-height: calc(100vh - var(--header-height));
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.page-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: var(--spacing-xs) 0 0 0;
}

/* ============================================
   TABS
   ============================================ */

.tabs-container {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--spacing-lg);
}

.tabs {
  display: flex;
  gap: var(--spacing-xs);
  overflow-x: auto;
  scrollbar-width: none;
}

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

.tab {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
}

.tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.tab-panel {
  display: none;
  min-width: 0;
}

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

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.card-body {
  padding: var(--spacing-md);
}

.card-footer {
  padding: var(--spacing-md);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
}

/* ============================================
   PROFILE GRID
   ============================================ */

.profiles-toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  padding-left: 40px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--color-text-tertiary);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
}

.filter-group {
  display: flex;
  gap: var(--spacing-xs);
}

.filters-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.filters-row .filter-group {
  flex-direction: column;
  align-items: flex-start;
  min-width: 200px;
}

.filters-row .filter-group .form-input,
.filters-row .filter-group .form-select {
  min-width: 220px;
}

.filters-row .filter-group:last-child {
  flex: 1;
  min-width: 280px;
}

.filters-row .filter-group:last-child .form-input,
.filters-row .filter-group:last-child .form-select {
  width: 100%;
}

@media (max-width: 900px) {
  .filters-row {
    align-items: stretch;
  }

  .filters-row .filter-group,
  .filters-row .filter-group:last-child {
    min-width: 100%;
  }
}

.filter-btn {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.filter-btn:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
}

.filter-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.filter-btn .count {
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 11px;
}

/* View Toggle (Grid/Table) */
.view-toggle {
  display: flex;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle-btn {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: transparent;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
}

.view-toggle-btn.active {
  background: var(--color-accent);
  color: white;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,
      minmax(var(--profile-card-min), 1fr));
  gap: var(--spacing-md);
}

.profiles-worker-summary {
  margin-left: var(--spacing-sm);
  font-size: 12px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* ============================================
   PROFILE CARD
   ============================================ */

.profile-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  transition: all 200ms ease;
}

.profile-card:hover {
  border-color: var(--color-accent-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.profile-card.selected {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-glow);
}

/* Status indicator bar */
.profile-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-idle);
}

.profile-card.status-active::before {
  background: var(--color-success);
}

.profile-card.status-paused::before {
  background: var(--color-warning);
}

.profile-card.status-error::before {
  background: var(--color-error);
}

.profile-card.status-limit::before {
  background: var(--color-error);
}

.profile-card-header {
  padding: var(--spacing-md);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

.profile-checkbox {
  margin-top: 2px;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-name-with-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.2;
}

.profile-name-main {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.profile-ocr-windows {
  display: block;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.9;
}

.profile-name-icon {
  display: inline-flex;
  margin-right: 6px;
  color: var(--color-error);
}

.profile-name-pro-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 0px 3px;
  border-radius: var(--radius-full);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #92400e;
  background: #fde68a;
  border: 1px solid #fcd34d;
  vertical-align: middle;
  line-height: 1.4;
}

.profile-name-free-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 0px 4px;
  border-radius: var(--radius-full);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e3a8a;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  vertical-align: middle;
  line-height: 1.4;
}

.profile-status-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xs);
}

.profile-headed-badge {
  display: none !important;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  background: var(--color-info-bg);
  color: var(--color-info);
}

.profile-headed-badge.visible {
  display: inline-flex !important;
}

.profile-alert-badge {
  display: none !important;
}

.profile-alert-badge.visible {
  display: inline-flex !important;
}

.profile-prompt-badge {
  display: none !important;
}

.profile-prompt-badge.visible {
  display: inline-flex !important;
}

.profile-row-archived {
  opacity: 0.5;
  filter: grayscale(0.4);
}

.profile-row-archived:hover {
  opacity: 0.75;
}

.segmented {
  display: inline-flex;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.segmented-btn {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
}

.segmented-btn.active {
  color: var(--color-text);
  background: var(--color-surface-2);
}

.preview-grid.preview-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.preview-list-item {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.preview-list-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

.preview-list-meta {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.preview-list-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
}

.preview-list-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

@media (max-width: 960px) {
  .preview-list-item {
    grid-template-columns: 1fr;
  }
}

.status-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.profile-status.active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.profile-status.paused {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.profile-status.error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.profile-status.limit {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.profile-status.idle {
  background: var(--color-idle-bg);
  color: var(--color-idle);
}

.profile-worker {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

.profile-card-body {
  padding: 0 var(--spacing-md) var(--spacing-md);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
}

.profile-stat {
  text-align: center;
  padding: var(--spacing-sm);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
}

.profile-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.profile-stat-label {
  font-size: 10px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
}

.profile-activity {
  margin-top: var(--spacing-sm);
  font-size: 11px;
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.profile-activity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.profile-card-actions {
  padding: var(--spacing-sm) var(--spacing-md);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--spacing-xs);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.profile-card:hover .profile-card-actions {
  opacity: 1;
}

.profile-action-btn {
  flex: 1;
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--color-bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-action-btn:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
}

.profile-action-btn.primary {
  background: var(--color-accent);
  color: white;
}

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

.profile-action-btn.danger {
  color: var(--color-error);
}

.profile-action-btn.danger:hover {
  background: var(--color-error-bg);
}

/* ============================================
   STATS CARDS GRID
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.stat-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.blue {
  background: var(--color-accent);
  color: white;
}

.stat-icon.green {
  background: var(--color-success);
  color: white;
}

.stat-icon.yellow {
  background: var(--color-warning);
  color: white;
}

.stat-icon.red {
  background: var(--color-error);
  color: white;
}

.stat-icon.cyan {
  background: var(--color-info);
  color: white;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

/* ============================================
   SETTINGS GRIDS
   ============================================ */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-sm);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--spacing-sm);
}

@media (max-width: 900px) {

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: var(--spacing-md);
}

.overview-grid .card {
  grid-column: 1 / -1;
}

.host-load-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.host-top-processes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-sm);
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.host-top-column {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.host-top-title {
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

@media (max-width: 700px) {
  .host-top-processes {
    grid-template-columns: 1fr;
  }
}

.stat-change {
  font-size: 12px;
  margin-top: var(--spacing-xs);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.stat-change.positive {
  color: var(--color-success);
}

.stat-change.negative {
  color: var(--color-error);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

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

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

.btn-secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
}

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

.btn-success:hover:not(:disabled) {
  filter: brightness(1.1);
}

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

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 12px;
}

.btn-lg {
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 16px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-tertiary);
  background: var(--color-bg-tertiary);
  position: sticky;
  top: 0;
}

.table td {
  font-size: 13px;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--color-bg-tertiary);
}

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

/* Keep profiles table within viewport when sidebar is expanded */
#profilesTable .table {
  table-layout: auto;
}

#profilesTable .table th:nth-child(3),
#profilesTable .table td:nth-child(3) {
  width: 88px;
  max-width: 88px;
}

#profilesTable .status-cell {
  max-width: 88px;
}

#profilesTable .status-cell .badge:first-child {
  max-width: 88px;
  display: inline-block;
  line-height: 1.15;
  overflow-wrap: anywhere;
  white-space: normal;
}

#profilesTable .table th:nth-child(2),
#profilesTable .table td:nth-child(2) {
  width: auto;
  min-width: 100px;
  max-width: 180px;
}

#profilesTable .table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {

  #profilesTable .table th:nth-child(2),
  #profilesTable .table td:nth-child(2) {
    max-width: 150px;
  }
}

/* Compress MODE column to keep full table visible */
#profilesTable .table th:nth-child(4),
#profilesTable .table td:nth-child(4) {
  width: 92px;
  min-width: 92px;
  max-width: 104px;
}

#profilesTable .table th,
#profilesTable .table td {
  padding: 6px 8px;
}

#profilesTable .table td {
  font-size: 12px;
}

#profilesTable .table th:last-child,
#profilesTable .table td:last-child {
  min-width: 140px;
  white-space: normal;
}

#profilesTable .table td:last-child .flex {
  flex-wrap: wrap;
  gap: 4px;
  row-gap: 2px;
}

/* Keep date/time columns tight to content */
#profilesTable .table th:nth-child(8),
#profilesTable .table td:nth-child(8),
#profilesTable .table th:nth-child(9),
#profilesTable .table td:nth-child(9),
#profilesTable .table th:nth-child(10),
#profilesTable .table td:nth-child(10),
#profilesTable .table th:nth-child(11),
#profilesTable .table td:nth-child(11) {
  width: 1%;
  white-space: nowrap;
}

/* Visual separation between Tryb and Przetw. columns */
#profilesTable .table th:nth-child(6),
#profilesTable .table td:nth-child(6) {
  border-left: 1px solid var(--color-border);
}

/* Keep the Tryb select fully inside its cell */
#profilesTable .execution-mode-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 2px 16px 2px 4px;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profilesTable .mode-proxy {
  display: none;
}

#profilesTable .mode-locations {
  display: none;
}

#profilesTable .table td:last-child .btn.btn-sm,
#profilesTable .table td:last-child .btn.btn-ghost.btn-sm {
  padding: 3px 6px;
  font-size: 10px;
}

/* Keep Done table columns visible without horizontal scrolling */
#doneTable {
  width: 100%;
  table-layout: fixed;
}

#doneTable th,
#doneTable td {
  padding: 6px 8px;
}

#doneTable th {
  font-size: 10px;
}

#doneTable td {
  font-size: 12px;
}

#doneTable th:nth-child(1),
#doneTable td:nth-child(1) {
  width: 4%;
  text-align: right;
  color: var(--color-text-secondary);
}

#doneTable th:nth-child(2),
#doneTable td:nth-child(2) {
  width: 27%;
  font-family: var(--font-mono);
}

#doneTable th:nth-child(3),
#doneTable td:nth-child(3) {
  width: 27%;
  color: var(--color-text-secondary);
}

#doneTable th:nth-child(4),
#doneTable td:nth-child(4) {
  width: 11%;
}

#doneTable th:nth-child(5),
#doneTable td:nth-child(5) {
  width: 13%;
  color: var(--color-text-secondary);
}

#doneTable th:nth-child(6),
#doneTable td:nth-child(6) {
  width: 6%;
  text-align: right;
  white-space: nowrap;
}

#doneTable th:nth-child(7),
#doneTable td:nth-child(7) {
  width: 8%;
  white-space: nowrap;
}

#doneTable th:nth-child(8),
#doneTable td:nth-child(8) {
  width: 4%;
  text-align: center;
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 4px;
}

#doneTable td:nth-child(2),
#doneTable td:nth-child(3),
#doneTable td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Keep Queue table columns visible while allowing full source-path display */
#queueTable {
  width: 100%;
  table-layout: fixed;
}

#queueTable th,
#queueTable td {
  padding: 6px 8px;
  vertical-align: top;
}

#queueTable th {
  font-size: 10px;
}

#queueTable td {
  font-size: 12px;
}

#queueTable th:nth-child(1),
#queueTable td:nth-child(1) {
  width: 4%;
  text-align: right;
}

#queueTable th:nth-child(2),
#queueTable td:nth-child(2) {
  width: 34%;
}

#queueTable th:nth-child(3),
#queueTable td:nth-child(3) {
  width: 34%;
}

#queueTable th:nth-child(4),
#queueTable td:nth-child(4) {
  width: 10%;
  white-space: nowrap;
}

#queueTable th:nth-child(5),
#queueTable td:nth-child(5) {
  width: 13%;
}

#queueTable th:nth-child(6),
#queueTable td:nth-child(6) {
  width: 5%;
  text-align: center;
  white-space: nowrap;
}

#queueTable .queue-row-num {
  font-size: 0.8rem;
}

#queueTable .queue-file-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

#queueTable .queue-source-path {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#queueTable .queue-locked-by {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#queueTable .queue-action-header-icon {
  display: inline-block;
  opacity: 0.7;
  vertical-align: middle;
}

#queueTable .queue-preview-btn {
  width: 26px;
  height: 24px;
  min-width: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#queueTable .queue-preview-btn svg {
  width: 12px;
  height: 12px;
}

#doneTable .done-action-header-icon {
  display: inline-block;
  opacity: 0.7;
  vertical-align: middle;
}

#doneTable .done-preview-btn {
  width: 26px;
  height: 24px;
  min-width: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#doneTable .done-preview-btn svg {
  width: 12px;
  height: 12px;
}

@media (max-width: 1024px) {

  #doneTable th,
  #doneTable td {
    padding: 4px 5px;
  }

  #doneTable th {
    font-size: 9px;
    letter-spacing: 0.02em;
  }

  #doneTable td {
    font-size: 11px;
  }

  #doneTable th:nth-child(1),
  #doneTable td:nth-child(1) {
    width: 5%;
  }

  #doneTable th:nth-child(2),
  #doneTable td:nth-child(2) {
    width: 24%;
  }

  #doneTable th:nth-child(3),
  #doneTable td:nth-child(3) {
    width: 23%;
  }

  #doneTable th:nth-child(4),
  #doneTable td:nth-child(4) {
    width: 13%;
  }

  #doneTable th:nth-child(5),
  #doneTable td:nth-child(5) {
    width: 14%;
  }

  #doneTable th:nth-child(6),
  #doneTable td:nth-child(6) {
    width: 7%;
  }

  #doneTable th:nth-child(7),
  #doneTable td:nth-child(7) {
    width: 8%;
  }

  #doneTable th:nth-child(8),
  #doneTable td:nth-child(8) {
    width: 6%;
  }

  #doneTable .done-preview-btn {
    width: 22px;
    height: 22px;
    min-width: 22px;
  }

  #doneTable .done-preview-btn svg {
    width: 11px;
    height: 11px;
  }

  #queueTable .queue-preview-btn {
    width: 22px;
    height: 22px;
    min-width: 22px;
  }

  #queueTable .queue-preview-btn svg {
    width: 11px;
    height: 11px;
  }
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-neutral {
  background: var(--color-idle-bg);
  color: var(--color-idle);
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress {
  height: 8px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar.success {
  background: var(--color-success);
}

.progress-bar.warning {
  background: var(--color-warning);
}

.progress-bar.error {
  background: var(--color-error);
}

/* ============================================
   LIVE PREVIEW
   ============================================ */

.live-preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-md);
}

.preview-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.preview-card-header {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}

.preview-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.preview-image-container {
  position: relative;
  background: var(--color-bg-primary);
  aspect-ratio: 16/10;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.preview-image-container:hover .preview-image {
  transform: scale(1.02);
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.preview-placeholder {
  color: var(--color-text-tertiary);
  font-size: 13px;
}

.preview-footer {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* ============================================
   LOGS
   ============================================ */

.log-container {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  min-height: 520px;
  max-height: 70vh;
  overflow-y: auto;
}

.log-entry {
  padding: var(--spacing-xs) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--spacing-md);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-time {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

.log-level {
  font-weight: 600;
  flex-shrink: 0;
  width: 50px;
}

.log-level.info {
  color: var(--color-info);
}

.log-level.warn {
  color: var(--color-warning);
}

.log-level.error {
  color: var(--color-error);
}

.log-level.success {
  color: var(--color-success);
}

.log-message {
  color: var(--color-text-primary);
  word-break: break-word;
}

/* ============================================
   BULK ACTIONS BAR
   ============================================ */

.bulk-actions-bar {
  position: fixed;
  bottom: var(--spacing-lg);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm) var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.bulk-actions-bar.visible {
  opacity: 1;
  visibility: visible;
}

.bulk-count {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.bulk-count strong {
  color: var(--color-accent);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-text-tertiary);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
}

.empty-message {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  bottom: var(--spacing-lg);
  left: var(--spacing-lg);
  z-index: 30000;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--spacing-sm);
}

.toast {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  min-width: 300px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

.toast.removing {
  animation: toast-slide-out 300ms ease-in;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--color-success);
}

.toast.warning .toast-icon {
  color: var(--color-warning);
}

.toast.error .toast-icon {
  color: var(--color-error);
}

.toast.info .toast-icon {
  color: var(--color-info);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-primary);
}

.toast-message {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.toast-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toast-copy {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.toast-copy:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
}

.toast-copy.copied {
  color: var(--color-success);
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

.modal-overlay.visible .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
}

.modal-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
}

.info-section {
  padding: var(--spacing-md);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.info-section h4 {
  margin: 0;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xs);
}

.form-input,
.form-select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.form-input::placeholder {
  color: var(--color-text-tertiary);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* ============================================
   EXECUTION MODE SELECT
   ============================================ */

.execution-mode-select {
  padding: 4px 24px 4px 8px;
  font-size: 10px;
  font-family: inherit;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: all var(--transition-fast);
  min-width: 70px;
}

.execution-mode-select:hover {
  border-color: var(--color-border-light);
  background-color: var(--color-bg-elevated);
}

.execution-mode-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.execution-mode-select option {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  padding: 8px;
}

.profile-card-mode {
  padding: var(--spacing-xs) var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

.profile-card-mode .execution-mode-select {
  width: 100%;
}

/* ============================================
   RESPONSIVE
   ============================================ */

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

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .header {
    grid-column: 1;
  }

  .header-stats {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  :root {
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --profile-card-min: 100%;
  }

  .page-title {
    font-size: 20px;
  }

  .profiles-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .filter-group {
    overflow-x: auto;
    padding-bottom: var(--spacing-xs);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .bulk-actions-bar {
    left: var(--spacing-md);
    right: var(--spacing-md);
    transform: none;
    width: auto;
  }
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-bg-elevated);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-bg-hover);
}

/* ============================================
   UTILITIES
   ============================================ */

.text-muted {
  color: var(--color-text-muted);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-primary {
  color: var(--color-text-primary);
}

.text-success {
  color: var(--color-success);
}

.text-warning {
  color: var(--color-warning);
}

.text-error {
  color: var(--color-error);
}

.text-info {
  color: var(--color-info);
}

.font-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

.font-medium {
  font-weight: 500;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.mt-sm {
  margin-top: var(--spacing-sm);
}

.mt-md {
  margin-top: var(--spacing-md);
}

.mt-lg {
  margin-top: var(--spacing-lg);
}

.mb-sm {
  margin-bottom: var(--spacing-sm);
}

.mb-md {
  margin-bottom: var(--spacing-md);
}

.mb-lg {
  margin-bottom: var(--spacing-lg);
}

.hidden {
  display: none !important;
}

.visible {
  visibility: visible;
}

.invisible {
  visibility: hidden;
}

/* ============================================
   CONNECTION STATUS
   ============================================ */

.connection-status {
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-sm);
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-error);
}

.connection-dot.connected {
  background: var(--color-success);
  animation: pulse 2s infinite;
}

/* ============================================
   CONFIG TABS (Start Job Modal)
   ============================================ */

.config-tabs {
  display: flex;
  gap: 2px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: var(--spacing-md);
}

.config-tab {
  flex: 1;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.config-tab:hover {
  color: var(--color-text-primary);
}

.config-tab.active {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.config-panel {
  display: none;
}

.config-panel.active {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

/* ============================================
   FILE BROWSER
   ============================================ */

.file-browser-favorites {
  background: var(--color-bg-tertiary);
}

.favorite-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.favorite-item:hover {
  background: var(--color-bg-elevated);
}

.file-list {
  background: var(--color-bg-primary);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.file-item:hover {
  background: var(--color-bg-tertiary);
}

.file-item:last-child {
  border-bottom: none;
}

.file-item.folder {
  color: var(--color-accent);
}

.file-item.file {
  color: var(--color-text-secondary);
  cursor: default;
}

/* ============================================
   SESSION BANNER
   ============================================ */

.session-banner {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  background: var(--color-error);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  z-index: 100;
  font-size: 13px;
  transition: left var(--transition-slow);
}

.session-banner.hidden {
  display: none;
}

.sidebar-collapsed .session-banner {
  left: var(--sidebar-collapsed);
}

/* ============================================
   ADDITIONAL UTILITIES
   ============================================ */

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
}

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

/* Live Preview styles merged into Preview Grid section above */

/* Image Preview Modal */
.image-preview-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.image-preview-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

#imagePreviewImg {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-md);
}

.image-preview-info {
  text-align: center;
  color: white;
  padding: var(--spacing-sm);
  font-size: 14px;
}

/* ============================================
   CLEANUP MODAL
   ============================================ */

.cleanup-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.cleanup-options .checkbox-label {
  display: flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-bg);
  border-radius: var(--radius-md);
}

/* ============================================
   ALERT BANNER
   ============================================ */

.alert-banner {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  padding: var(--spacing-sm) var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  z-index: 100;
  font-size: 13px;
  transition: left var(--transition-slow);
}

.alert-banner.warning {
  background: linear-gradient(135deg,
      rgba(245, 158, 11, 0.15),
      rgba(245, 158, 11, 0.1));
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-warning);
}

.alert-banner.hidden {
  display: none;
}

.sidebar-collapsed .alert-banner {
  left: var(--sidebar-collapsed);
}

/* ============================================
   HEADER ACTIONS DIVIDER
   ============================================ */

.header-actions-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border);
  margin: 0 var(--spacing-xs);
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

.lang-switcher {
  display: flex;
  gap: 2px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.lang-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  color: var(--color-text);
  background: var(--color-bg-tertiary);
}

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

/* ============================================
   UI/UX ENHANCEMENTS - 2026
   Accessibility + Visual Polish
   ============================================ */

/* ============================================
   1. ACCESSIBILITY - FOCUS STATES (WCAG AAA)
   ============================================ */

/* Visible focus indicators for keyboard navigation */
.nav-item:focus-visible,
.btn:focus-visible,
.filter-btn:focus-visible,
.search-input:focus-visible,
.tab:focus-visible,
.profile-card:focus-visible,
.sidebar-toggle:focus-visible,
.lang-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* Remove default outline when using mouse */
.nav-item:focus:not(:focus-visible),
.btn:focus:not(:focus-visible),
.filter-btn:focus:not(:focus-visible),
.tab:focus:not(:focus-visible) {
  outline: none;
}

/* Duplicates removed - merged into original definitions */

/* Custom Scrollbar styles merged into Scrollbar section above */

/* ============================================
   7. LOADING SKELETON SCREENS
   ============================================ */

@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(90deg,
      var(--color-bg-tertiary) 0px,
      var(--color-bg-elevated) 40px,
      var(--color-bg-tertiary) 80px);
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite ease-in-out;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 12px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-text.large {
  height: 16px;
}

.skeleton-text.small {
  height: 10px;
}

.skeleton-circle {
  border-radius: 50%;
}

/* ============================================
   8. BUTTON DISABLED STATES
   ============================================ */

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
}

.btn-primary:disabled,
.btn-primary.disabled {
  background: var(--color-bg-elevated);
  color: var(--color-text-tertiary);
  box-shadow: none;
}

.btn-secondary:disabled,
.btn-secondary.disabled {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

/* Toast animations merged into Toast Notifications section above */

/* ============================================
   10. ADDITIONAL MICRO-INTERACTIONS
   ============================================ */

/* Smooth badge pulse on updates */
@keyframes badge-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.nav-item-badge.updated {
  animation: badge-pulse 600ms ease-in-out;
}

/* Status indicator pulse for active profiles */
@keyframes status-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.profile-status.active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 4px;
  animation: status-pulse 2s infinite ease-in-out;
}

/* Smooth card entrance animation */
@keyframes card-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-card.entering {
  animation: card-fade-in 400ms ease-out;
}

/* ============================================
   11. IMPROVED INTERACTIVE STATES
   ============================================ */

/* Better checkbox styling */
input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Better select styling */
select {
  cursor: pointer;
  transition: all var(--transition-fast);
}

select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* ============================================
   12. RESPONSIVE IMPROVEMENTS
   ============================================ */

/* Ensure touch targets are at least 44x44px on mobile */
@media (max-width: 768px) {

  .nav-item,
  .btn,
  .filter-btn,
  .tab {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ============================================
   13. PRINT STYLES (BONUS)
   ============================================ */

@media print {

  .sidebar,
  .header-actions,
  .btn,
  .filter-btn {
    display: none !important;
  }

  .main-content {
    grid-column: 1 / -1;
  }

  .profile-card {
    break-inside: avoid;
  }
}

/* ============================================
   COMMAND CENTER HERO (OLED STYLE)
   ============================================ */

.stats-hero {
  background: linear-gradient(180deg,
      rgba(15, 23, 42, 0.6) 0%,
      rgba(15, 23, 42, 0) 100%);
  padding: calc(var(--spacing-lg) / 3) 0;
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.stats-hero-container {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: var(--spacing-lg);
  align-items: center;
}

.hero-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-group-main {
  justify-content: center;
  height: 100%;
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(17, 24, 39, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.hero-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

/* Primary "Today" Card */
.hero-card-primary {
  background: radial-gradient(circle at center,
      rgba(59, 130, 246, 0.08) 0%,
      rgba(17, 24, 39, 0.4) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 10px;
  height: 100%;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.05);
}

.hero-card-primary:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 50px rgba(59, 130, 246, 0.15);
  transform: scale(1.02);
}

.hero-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-tertiary);
}

.hero-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.hero-value-lg {
  font-size: 28px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

.hero-main-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Color Accents */
.hero-card-success {
  border-left: 2px solid var(--color-success);
}

.hero-card-success .hero-value {
  color: var(--color-success);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.hero-card-warning {
  border-left: 2px solid var(--color-warning);
}

.hero-card-warning .hero-value {
  color: var(--color-warning);
}

.hero-card-error {
  border-left: 2px solid var(--color-error);
}

.hero-card-error .hero-value {
  color: var(--color-error);
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.hero-card-neutral {
  border-left: 2px solid var(--color-border);
}

.hero-icon-wrapper {
  background: rgba(59, 130, 246, 0.1);
  padding: 4px;
  border-radius: 12px;
  color: var(--color-accent);
}

/* Alignment Fix */
/* Header actions alignment merged into main definition */

/* Responsive */
@media (max-width: 1024px) {
  .stats-hero-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .hero-group-wide {
    order: -1;
  }
}

/* ============================================
   SETTINGS TAB REFACTOR
   ============================================ */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
}

.settings-card-full {
  grid-column: 1 / -1;
}

.host-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-md);
}

.host-card {
  background: var(--color-bg-tertiary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.host-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.host-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text-primary);
}

.host-fields {
  display: grid;
  gap: 8px;
}

.compact-form-label {
  display: block;
  font-size: 11px;
  margin-bottom: 2px;
  color: var(--color-text-secondary);
}

.compact-form-input {
  width: 100%;
  font-size: 12px;
  padding: 4px 8px;
  background: var(--color-bg-secondary);
  /* Darker than tertiary card */
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  transition: border-color var(--transition-fast);
}

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

.compact-checkbox-span {
  font-size: 11px;
}

.details-advanced {
  font-size: 12px;
  margin-top: 4px;
}

.details-advanced summary {
  cursor: pointer;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  user-select: none;
}

.details-advanced summary:hover {
  color: var(--color-text-primary);
}

.details-advanced-content {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

.presets-toolbar {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
  align-items: center;
}

.presets-label {
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-right: 8px;
}

.presets-separator {
  border-left: 1px solid var(--color-border);
  height: 20px;
  margin: 0 8px;
}

.settings-section-divider {
  margin: var(--spacing-md) 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

.settings-mt {
  margin-top: var(--spacing-md);
}

.icon-gap {
  margin-right: 4px;
}

.compact-checkbox-nomargin {
  margin: 0;
}

.compact-checkbox-mt {
  margin-top: 4px;
}

.host-port-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ============================================
   HOST CONFIG MODAL COMPACT LAYOUT
   ============================================ */

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

#hostConfigModal .modal-body {
  padding: 12px 14px;
}

#hostConfigModal .modal-footer {
  padding: 10px 14px;
}

#hostConfigModal .host-config-grid {
  gap: 10px 12px;
}

#hostConfigModal .form-group {
  margin-bottom: 6px;
}

#hostConfigModal .compact-form-label {
  margin-bottom: 3px;
}

#hostConfigModal .settings-section-divider {
  margin: 8px 0 !important;
}

#hostConfigModal .host-port-grid {
  gap: 6px 8px;
}

#hostConfigModal #hostDeploySection .settings-grid {
  gap: 6px 8px !important;
}

#hostConfigModal small {
  line-height: 1.3;
}

#hostConfigModal #hostDeployLogContainer,
#hostConfigModal #hostTestResultContainer {
  margin-top: 8px !important;
}

/* Sortable table headers */
.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.th-sort:hover {
  color: var(--color-text-primary);
  background-color: var(--color-bg-tertiary);
}

.th-sort .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.35;
  font-size: 0.75em;
  vertical-align: middle;
  transition: opacity 0.15s;
}

.th-sort.sort-asc .sort-icon,
.th-sort.sort-desc .sort-icon {
  opacity: 1;
  color: var(--color-primary, #6366f1);
}

@media (max-width: 768px) {
  #hostConfigModal .host-config-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
