:root {
  --bg-color: #08080c;
  --sidebar-bg: #111116;
  --panel-bg: rgba(25, 25, 35, 0.7);
  --accent-primary: #8b5cf6;
  /* Vibrant Purple */
  --accent-secondary: #06b6d4;
  /* Cyber Cyan */
  --text-main: #f3f4f6;
  --text-dim: #9ca3af;
  --glass-border: rgba(255, 255, 255, 0.08);
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-width: 260px;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
}

#mainApp {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* --- Layout --- */

aside.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 100;
}

main.content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem 3rem;
  position: relative;
  transition: all 0.3s ease;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 40%);
}

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.mobile-toggle {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-small {
  font-weight: 800;
  font-size: 1rem;
  background: linear-gradient(135deg, white, var(--text-dim));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-avatar-small {
  width: 32px;
  height: 32px;
  background: var(--accent-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
}

@media (max-width: 992px) {
  #mainApp {
    flex-direction: column;
  }

  .mobile-header {
    display: flex;
  }

  aside.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
  }

  aside.sidebar.mobile-active {
    transform: translateX(0);
  }

  main.content {
    padding: 1.5rem 1rem;
    width: 100%;
    height: calc(100vh - 65px);
  }

  .wide-view main.content {
    padding: 1.5rem 1rem;
  }

  /* Add overlay when sidebar is open */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
}

.wide-view main.content {
  padding: 2rem 10%;
}

.wide-view aside.sidebar {
  display: none;
}

@media (max-width: 992px) {
  .wide-view aside.sidebar {
    display: flex;
  }

  .wide-view main.content {
    padding: 1.5rem 1rem;
  }
}

/* --- Sidebar UI --- */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 3rem;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

/* --- Components --- */

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  gap: 20px;
  flex-wrap: wrap;
  /* Mobile fix: Allow wrapping if name is too long */
}

/* Handle long project titles */
.header-row>div:first-child {
  flex: 1;
  min-width: 250px;
  max-width: 100%;
}

#currentProjectTitle {
  word-wrap: break-word;
  word-break: break-all;
  /* Force breaks for long underscores/filenames */
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  /* Standard property for compatibility */
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 4px;
}

.btn-premium {
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-premium:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
  filter: brightness(1.1);
}

/* --- Modern Dashboard Table --- */
.table-container-modern {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.dashboard-table th {
  background: rgba(255, 255, 255, 0.05);
  padding: 18px 25px;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--glass-border);
}

.dashboard-table td {
  padding: 16px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.table-row-premium {
  transition: all 0.2s ease;
  cursor: pointer;
}

.table-row-premium:hover {
  background: rgba(139, 92, 246, 0.04);
}

.table-row-premium:last-child td {
  border-bottom: none;
}

.table-proj-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
}

.table-proj-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: monospace;
  opacity: 0.6;
}

.table-date-cell {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.table-delete-btn {
  width: 32px;
  height: 32px;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  margin: 0 auto;
}

.table-delete-btn:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

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

/* Badge normalization for table */
.dashboard-table .badge {
  padding: 3px 10px;
  font-size: 0.7rem;
}

/* Status Filters */
.search-row {
  flex-wrap: wrap;
  gap: 1.5rem;
  display: flex;
  align-items: center;
  margin-bottom: 2.5rem;
  /* Added spacing to separate from table */
}

.filter-group {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 4px;
  border-radius: 12px;
  display: flex;
  gap: 4px;
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 18px;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.user-filter-select {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent-secondary);
  padding: 8px 32px 8px 16px;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2306b6d4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  min-width: 140px;
}

.user-filter-select:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-secondary);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.1);
}

.user-filter-select:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.user-filter-select option {
  background: #111118;
  color: white;
  padding: 10px;
}

.search-container {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  font-size: 1.2rem;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.dashboard-search-input {
  width: 100%;
  padding: 14px 20px 14px 50px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
  font-size: 0.95rem;
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dashboard-search-input:focus {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 8px 30px rgba(0, 0, 0, 0.4);
  outline: none !important;
}

.dashboard-search-input:focus+.search-icon {
  opacity: 1;
  color: var(--accent-primary);
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.project-card {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.project-card:hover {
  border-color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.05);
  transform: translateY(-4px);
}

.project-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 12px;
  display: block;
}

.project-stats {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-complete {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* Upload Zone */
#uploadView {
  max-width: 800px;
  margin: 0 auto;
}

.upload-box {
  border: 2px dashed var(--glass-border);
  border-radius: 24px;
  padding: 4rem;
  text-align: center;
  background: var(--panel-bg);
  cursor: pointer;
  transition: all 0.3s;
}

.upload-box:hover,
.upload-box.dragover {
  border-color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.03);
}

/* Editor / Review Styles */
.editor-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chunk-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chunk-item {
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
}

.timecode-label {
  font-family: monospace;
  color: var(--accent-secondary);
  font-weight: bold;
}

.text-area-modern {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem;
  color: white;
  font-size: 1rem;
  margin-top: 10px;
  resize: none;
  min-height: 80px;
}

/* Suspect Filter Labels */
.suspect-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  margin-right: 8px;
}

.suspect-negative {
  color: white;
  background: var(--error);
}

.suspect-long {
  color: #000;
  background: var(--warning);
}

.suspect-conflict {
  color: #000;
  background: var(--accent-secondary);
}

.time-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--accent-secondary);
  font-family: monospace;
  font-size: 0.8rem;
  width: 110px;
}

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

/* Utility */
.hidden {
  display: none !important;
}

/* =============================== */
/* Chunk Action Buttons             */
/* =============================== */

.chunk-action-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.chunk-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

.chunk-copy-btn:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.chunk-verify-btn {
  background: var(--accent-secondary);
  color: #000;
}

.chunk-verify-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

/* Loading State */
.btn-loading {
  opacity: 0.85;
  pointer-events: none;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
}

@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Success Flash */
@keyframes successPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.btn-success-flash {
  background: var(--success) !important;
  color: white !important;
  border-color: var(--success) !important;
  transform: scale(1.05);
  animation: successPulse 0.6s ease;
}

/* Error Flash */
@keyframes errorShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-3px);
  }

  40% {
    transform: translateX(3px);
  }

  60% {
    transform: translateX(-2px);
  }

  80% {
    transform: translateX(2px);
  }
}

.btn-error-flash {
  background: var(--error) !important;
  color: white !important;
  border-color: var(--error) !important;
  animation: errorShake 0.4s ease;
}

/* Custom Scroll */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* =============================== */
/* Error Inspector Modal           */
/* =============================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.error-inspector {
  background: #111118;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 24px;
  width: 90%;
  max-width: 520px;
  padding: 0;
  overflow: hidden;
  box-shadow:
    0 0 50px rgba(239, 68, 68, 0.1),
    0 0 100px rgba(139, 92, 246, 0.05);
  animation: expandSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Badge Header */
.error-inspector-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 16px;
}

.error-badge-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.15);
  flex-shrink: 0;
}

.error-badge-info h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.error-badge-count {
  font-size: 0.82rem;
  color: var(--error);
  font-weight: 600;
  margin-top: 3px;
}

/* Progress Bar */
.error-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.error-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--error), #f97316);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Error Card */
.error-card {
  margin: 16px 20px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
}

.error-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.06);
  border-bottom: 1px solid var(--glass-border);
}

.error-card-position {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--error);
  background: rgba(239, 68, 68, 0.12);
  padding: 3px 10px;
  border-radius: 20px;
}

.chunk-item .text-area-modern {
  min-height: 220px;
}

.error-card-line {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.error-card-body {
  padding: 16px;
  line-height: 1.6;
  font-size: 0.9rem;
  animation: errorCardIn 0.3s ease;
}

@keyframes errorCardIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }

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

/* Diff Display */
.diff-box {
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  margin-top: 8px;
}

.diff-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.diff-original {
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-pasted {
  color: var(--error);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-original::before {
  content: '✓';
  font-size: 0.7rem;
  opacity: 0.7;
}

.diff-pasted::before {
  content: '✗';
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Error Navigation */
.error-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 20px 4px;
}

.error-nav-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.error-nav-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--text-main);
}

.error-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Error Dots */
.error-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.error-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: all 0.25s;
  cursor: pointer;
}

.error-dot.active {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  transform: scale(1.3);
}

.error-dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.25);
}

/* Actions */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
}

.error-action-cancel {
  padding: 9px 20px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.error-action-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.error-action-confirm {
  padding: 9px 22px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.error-action-confirm:hover {
  background: #f59e0b;
  color: #000;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}


.error-action-fix {
  padding: 9px 22px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.error-action-fix:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
  filter: brightness(1.1);
}

/* ====================== */
/* Expand Editor Modal    */
/* ====================== */

@keyframes expandSlideUp {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.expand-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.25s ease;
}

.expand-editor {
  width: 92vw;
  height: 90vh;
  max-width: 1200px;
  background: #111118;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(139, 92, 246, 0.12),
    0 0 120px rgba(6, 182, 212, 0.06);
  animation: expandSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Header --- */
.expand-header {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(17, 17, 24, 0.95);
  flex-shrink: 0;
}

.expand-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 12px;
}

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

.expand-find-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 20px 12px 20px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.15);
}

.expand-replace-row {
  margin-top: 4px;
}

.expand-replace-box {
  background: rgba(139, 92, 246, 0.06) !important;
  border-color: rgba(139, 92, 246, 0.2) !important;
}

.expand-action-btn-accent {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--accent-secondary);
}

.expand-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.expand-icon {
  font-size: 1.3rem;
}

.expand-title-area h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.expand-search-area {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.expand-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 6px 14px;
  width: 100%;
  max-width: 650px;
  transition: all 0.2s;
}

#expandReplaceInput {
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  flex: 1;
  min-width: 80px;
}

.expand-replace-divider {
  width: 1px;
  height: 20px;
  background: var(--glass-border);
  margin: 0 4px;
}

.expand-replace-btns,
.expand-search-nav {
  display: flex;
  gap: 4px;
}

.expand-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.expand-action-btn:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent-primary);
  color: var(--text-main);
}

.expand-search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}

.expand-search-icon {
  color: var(--text-dim);
  flex-shrink: 0;
}

.expand-search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  min-width: 0;
}

.expand-search-box input::placeholder {
  color: rgba(156, 163, 175, 0.5);
}

.expand-match-count {
  font-size: 0.75rem;
  color: var(--accent-secondary);
  font-weight: 600;
  white-space: nowrap;
  min-width: 50px;
  text-align: center;
}

.expand-nav-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.expand-nav-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.expand.qa-row.qa-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

/* Active Highlight for Smart Paste */
.qa-row.row-active-focus {
  background: rgba(139, 92, 246, 0.03) !important;
  border-top-color: rgba(139, 92, 246, 0.3) !important;
  border-bottom-color: rgba(139, 92, 246, 0.3) !important;
  box-shadow: inset 2px 0 0 var(--accent-primary);
}

.qa-row.row-active-focus .col-text textarea {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(139, 92, 246, 0.4);
}

.expand-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.expand-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
  color: var(--error);
}

/* --- Body (Editor Area) --- */
.expand-body {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.expand-line-numbers {
  width: 52px;
  padding: 16px 8px 16px 0;
  text-align: right;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  color: rgba(156, 163, 175, 0.35);
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid var(--glass-border);
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}

.expand-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 16px 20px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-main);
  tab-size: 4;
  white-space: pre;
  overflow-y: auto;
  overflow-x: auto;
  z-index: 1;
}

.expand-textarea::selection {
  background: rgba(139, 92, 246, 0.3);
}

.expand-highlight-layer {
  display: none;
}

/* --- Footer --- */
.expand-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--glass-border);
  background: rgba(17, 17, 24, 0.95);
  flex-shrink: 0;
}

.expand-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.expand-stat-sep {
  color: rgba(255, 255, 255, 0.15);
}

.expand-footer-actions {
  display: flex;
  gap: 10px;
}

.expand-btn-secondary {
  padding: 8px 20px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.expand-btn-primary {
  padding: 8px 24px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.expand-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
  filter: brightness(1.1);
}

/* Search highlight in textarea (handled via JS overlay) */
.search-highlight-mark {
  background: rgba(245, 158, 11, 0.35);
  color: inherit;
  border-radius: 2px;
}

.search-highlight-active {
  background: rgba(139, 92, 246, 0.6);
  outline: 2px solid var(--accent-primary);
  border-radius: 2px;
}

/* --- Compare Sync Functionality --- */
.ln-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  height: 1.65em;
  gap: 4px;
}

.ln-num {
  opacity: 0.8;
}

.ln-sync-btn {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  border-radius: 4px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ln-row:hover .ln-sync-btn {
  opacity: 1;
}

.ln-sync-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  color: var(--accent-secondary);
}

/* Master Sync Bar between panes */
.expand-sync-bar {
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 50px;
  /* Below labels */
  background: rgba(0, 0, 0, 0.1);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  flex-shrink: 0;
  z-index: 10;
}

.sync-master-btn {
  width: 32px;
  height: 32px;
  background: var(--panel-bg);
  border: 1px solid var(--accent-primary);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.sync-master-btn:hover {
  transform: scale(1.1);
  background: var(--accent-primary);
  color: white;
}

/* Chunk expand button */
.chunk-expand-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chunk-expand-btn:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Quick Filter Bar */
.expand-quick-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.expand-quick-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
}

.expand-quick-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.expand-quick-btn:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--text-main);
}

.expand-quick-btn.active {
  background: rgba(139, 92, 246, 0.18);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

.expand-quick-btn-icon {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent-secondary);
}

.expand-quick-result-count {
  font-size: 0.75rem;
  color: var(--accent-secondary);
  font-weight: 600;
  margin-left: 4px;
}

.expand-qf-nav {
  width: 24px;
  height: 24px;
  font-size: 0.6rem;
}

.expand-quick-clear {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
  font-family: var(--font-main);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}

.expand-quick-clear:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: var(--error);
}

/* ====================== */
/* Split View / Compare   */
/* ====================== */

.expand-split-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}

.expand-split-btn:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-secondary);
}

.expand-split-btn.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.12);
}

/* Pane Layout */
.expand-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: flex 0.3s ease;
}

.expand-pane-left {
  flex: 1;
}

.expand-pane-right {
  border-left: 2px solid rgba(6, 182, 212, 0.2);
}

.expand-pane-inner {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Pane Labels */
.expand-pane-label {
  display: none;
  padding: 6px 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.06);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.expand-pane-label-original {
  color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.06);
}

/* Show labels only when split is active */
.expand-body.split-active .expand-pane-label {
  display: block;
}

/* Original textarea styling */
.expand-textarea-original {
  background: rgba(0, 0, 0, 0.12);
  color: rgba(243, 244, 246, 0.7);
  cursor: default;
}

.expand-textarea-original::selection {
  background: rgba(6, 182, 212, 0.2);
}

/* Split active state */
.expand-body.split-active {
  display: flex;
  flex-direction: row;
}

.expand-body.split-active .expand-pane-left {
  flex: 1;
}

.expand-body.split-active .expand-pane-right {
  flex: 1;
}

/* =========================== */
/* Redesigned QA & Review View */
/* =========================== */

.qa-header-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  background: var(--panel-bg);
  padding: 1.5rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}

.qa-stat-group {
  display: flex;
  gap: 1rem;
}

.qa-stat-card {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-width: 90px;
  cursor: pointer;
  transition: all 0.2s;
}

.qa-stat-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
}

.qa-stat-card.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent-primary);
}

.qa-stat-card.suspect.active {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
}

.qa-stat-card .label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
}

.qa-stat-card .value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.qa-stat-card.suspect .value {
  color: var(--error);
}

.qa-search-tools {
  display: flex;
  gap: 1rem;
  flex: 1;
  max-width: 500px;
}

.qa-search {
  max-width: none !important;
}

.qa-quick {
  background: none !important;
  border-bottom: none !important;
  padding: 0 !important;
}

/* QA Download Bar */
.qa-download-bar {
  padding: 1.5rem 0;
  margin-top: 1rem;
}

.qa-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
  border-radius: 16px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.3);
}

.qa-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.45);
  filter: brightness(1.1);
}

/* QA Find & Replace Box */
.qa-find-replace-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 8px;
  flex: 1;
  min-width: 0;
}

.qa-fr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.qa-fr-row input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  padding: 6px 0;
}

.qa-fr-row input::placeholder {
  color: rgba(156, 163, 175, 0.5);
}

.qa-fr-replace-row {
  background: rgba(139, 92, 246, 0.06);
  border: 1px dashed rgba(139, 92, 246, 0.2);
  animation: expandSlideUp 0.2s ease-out;
}

/* QA Table */
.qa-table-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qa-row {
  display: grid;
  grid-template-columns: 50px 140px 140px 80px 1fr 340px;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  transition: all 0.2s;
}

.qa-row:hover:not(.qa-header) {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(255, 255, 255, 0.02);
}

.qa-header {
  background: rgba(0, 0, 0, 0.3);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  border-color: transparent;
}

.qa-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 350px);
  min-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Expansion when header is hidden */
.qa-header-hidden .qa-list {
  max-height: calc(100vh - 165px) !important;
}

/* =========================== */

/* QA Floating Search Window   */
/* =========================== */

.qa-web-window {
  position: fixed;
  width: 480px;
  height: 520px;
  top: 150px;
  right: 50px;
  background: rgba(17, 17, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--accent-primary);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 92, 246, 0.1);
  z-index: 3000;
  animation: slideInUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.web-window-header {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  border-bottom: 1px solid var(--glass-border);
}

.web-window-header:active {
  cursor: grabbing;
}

.window-controls {
  display: flex;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.2s;
}

.dot:hover {
  opacity: 0.8;
}

.dot.red {
  background: #ff5f56;
}

.dot.yellow {
  background: #ffbd2e;
}

.dot.green {
  background: #27c93f;
}

.window-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.web-window-address {
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.2);
}

.web-window-content {
  flex: 1;
  background: white;
}

.web-window-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

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

/* Floating Selection Menu */
.selection-menu {
  position: absolute;
  z-index: 2000;
  display: flex;
  background: #1a1a24;
  border: 1px solid var(--accent-primary);
  border-radius: 12px;
  padding: 5px;
  gap: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: bounceIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.selection-action {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.selection-action:hover {
  background: var(--accent-primary);
  transform: translateY(-2px);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

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

@keyframes bounceIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }

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

.col-id {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: monospace;
}

.col-time input {
  width: 100%;
}

.col-dur {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--accent-secondary);
  text-align: center;
}

.col-text .text-area-modern {
  min-height: 40px;
  font-size: 0.85rem;
  margin-top: 0;
  padding: 6px 12px;
}

.col-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Fix & Suggestion Buttons */
.qa-fix-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.qa-fix-btn:hover {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.qa-fix-btn.smart-suggest {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.05);
}

.qa-fix-btn.smart-suggest:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--warning);
  color: var(--warning);
}

.qa-fix-btn.original-lookup {
  background: rgba(139, 92, 246, 0.05);
  border-color: rgba(139, 92, 246, 0.2);
  color: var(--accent-primary);
}

.qa-fix-btn.original-lookup:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-primary);
}

.suspect-row {
  border-color: rgba(239, 68, 68, 0.25) !important;
  background: rgba(239, 68, 68, 0.02) !important;
}

.suspect-row:hover {
  border-color: var(--error) !important;
}

/* Nested Original row style */
.qa-row-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qa-row-original {
  display: grid;
  grid-template-columns: 50px 140px 140px 80px 1fr 340px;
  gap: 1rem;
  align-items: center;
  padding: 0.6rem 1.5rem;
  background: rgba(139, 92, 246, 0.03);
  border: 1px dashed rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  opacity: 0.8;
  margin-bottom: 8px;
  animation: expandSlideUp 0.15s ease-out;
}

.qa-row-original .col-id {
  color: var(--accent-primary);
  opacity: 0.7;
}

.qa-row-original .col-time {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: monospace;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 12px;
  border-radius: 6px;
}

.qa-row-original .col-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

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

.qa-header-stats {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top;
}

.qa-header-stats-hidden {
  height: 0;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  border-color: transparent !important;
}

/* Floating Glossary Hub (Bottom Right) */
.glossary-hub {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 320px;
  height: 400px;
  background: rgba(17, 17, 24, 0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--accent-primary);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(139, 92, 246, 0.1);
  z-index: 3500;
  animation: bounceIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.glossary-hub.hidden {
  display: none;
}

.glossary-hub-header {
  background: rgba(139, 92, 246, 0.1);
  padding: 15px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hub-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.hub-subtitle {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.glossary-hub-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Toggle Trigger Button */
.glossary-trigger-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--accent-primary);
  border: none;
  border-radius: 15px;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glossary-trigger-btn:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 15px 35px rgba(139, 92, 246, 0.6);
}

.glossary-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--error);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }

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

.glossary-item {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.glossary-item:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent-primary);
  transform: translateX(-5px);
}

/* Inline Glossary Tags */
.glossary-tag {
  background: rgba(139, 92, 246, 0.15);
  border-bottom: 2px solid var(--accent-primary);
  cursor: help;
  padding: 0 2px;
  border-radius: 2px;
  position: relative;
}

.glossary-tag::after {
  content: attr(data-ku);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-primary);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 100;
}

.glossary-tag:hover::after {
  opacity: 1;
  bottom: calc(100% + 5px);
}

/* --- Auth & User Profile --- */

.auth-card {
  background: rgba(25, 25, 35, 0.6);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: expandSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-card h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-align: center;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-profile {
  margin-top: 1.5rem;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--accent-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logout-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 4px;
}

.logout-icon:hover {
  opacity: 1;
}

/* Fix for Select appearance */
select.text-area-modern {
  color: var(--text-main);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%239ca3af%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem top 50%;
  background-size: 0.65rem auto;
}

select.text-area-modern option {
  background: #111116;
  color: white;
}

@keyframes expandSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.auth-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #08080c 100%);
  z-index: 10000;
  padding: 20px;
  box-sizing: border-box;
}

.btn-pulse {
  animation: btnPulse 2s infinite;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
  border: none !important;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4) !important;
  opacity: 1 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* ========================================= */
/* MOBILE APP-STYLE QUALITY ASSURANCE (QA)  */
/* ========================================= */

@media (max-width: 992px) {

  /* 1. Reset high-level containers for full width */
  #reviewView {
    padding: 0 !important;
  }

  #reviewView .header-row {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
    margin-bottom: 0;
  }

  #reviewView .header-row div:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  #reviewView .btn-premium {
    padding: 10px 12px;
    font-size: 0.8rem;
    justify-content: center;
  }

  /* 2. Stats Bar Optimization */
  #qaHeaderStats {
    flex-direction: column;
    gap: 15px;
    padding: 1rem 1.5rem;
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
  }

  .qa-stat-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .qa-stat-card {
    padding: 10px 5px;
    text-align: center;
    min-width: 0;
  }

  .qa-stat-card .label {
    font-size: 0.6rem;
  }

  .qa-stat-card .value {
    font-size: 0.9rem;
  }

  .qa-search-tools {
    max-width: none;
  }

  /* 3. Card-based List Transformation */
  .qa-table-container {
    padding: 0;
    margin-top: 5px;
  }

  .qa-header {
    display: none !important;
  }

  .qa-list {
    padding: 0;
    gap: 1px;
    max-height: none;
    /* Let the container/body handle verticality */
    overflow-y: visible;
  }

  /* The Card */
  .qa-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0;
    position: relative;
  }

  .qa-row:hover:not(.qa-header) {
    background: rgba(255, 255, 255, 0.05);
  }

  .qa-row-group {
    background: rgba(0, 0, 0, 0.2) !important;
    margin-top: 10px;
    padding-top: 10px;
    border-radius: 12px;
  }

  /* Column logic for cards */
  .qa-row>div {
    width: 100% !important;
    text-align: left !important;
    padding: 0 !important;
  }

  .col-id {
    font-size: 1.2rem !important;
    font-weight: 800;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px !important;
    margin-bottom: 5px;
  }

  .col-id::before {
    content: '#';
    opacity: 0.5;
  }

  .col-id::after {
    content: 'SUBTITLE BLOCK';
    font-size: 0.65rem;
    color: var(--text-dim);
    font-weight: 500;
    margin-left: auto;
  }

  .col-time {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
  }

  .col-time input {
    flex: 1;
    min-width: 0;
    font-family: monospace;
    font-size: 0.8rem;
    padding: 8px !important;
  }

  .col-dur {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-secondary);
    padding: 5px 10px;
    font-weight: 700;
    border-radius: 6px;
    font-size: 0.75rem;
    text-align: center;
    width: auto !important;
    /* Fixed: Not big/empty anymore */
    border: 1px solid rgba(6, 182, 212, 0.2);
    white-space: nowrap;
  }

  /* --- Show Original Feature (Mobile) --- */
  .qa-row-original {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.25rem;
    background: rgba(139, 92, 246, 0.05);
    border: 1px dashed var(--accent-primary) !important;
    border-radius: 12px;
    margin: 5px 1rem 15px 1rem !important;
    /* Added margin for app look */
    opacity: 1;
  }

  .qa-row-original>div {
    width: 100% !important;
    text-align: left !important;
    padding: 0 !important;
  }

  .qa-row-original .col-id {
    font-size: 0.8rem !important;
    opacity: 0.6;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  }

  .qa-row-original .col-time {
    font-size: 0.75rem;
    color: var(--text-dim);
  }

  .qa-row-original .col-text {
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.1);
    padding: 10px !important;
    border-radius: 8px;
  }

  .col-text textarea {
    min-height: 100px;
    font-size: 1.1rem !important;
    line-height: 1.5;
    padding: 15px !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    background: rgba(0, 0, 0, 0.3) !important;
  }

  .col-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .col-actions .qa-fix-btn {
    width: 100%;
    justify-content: center;
    padding: 12px !important;
  }

  /* --- Expand Editor (Refined Mobile View) --- */
  .expand-editor {
    width: 96vw !important;
    height: auto !important;
    max-height: 94vh !important;
    border-radius: 24px !important;
    max-width: none !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    margin: 2vh auto;
    overflow-y: auto;
  }

  .expand-line-numbers {
    display: none !important;
  }

  .expand-textarea {
    padding-left: 18px !important;
    font-size: 1rem !important;
    line-height: 1.7 !important;
  }

  .expand-search-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .expand-search-box {
    max-width: none;
    padding: 6px 12px !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    height: auto !important;
    background: rgba(0, 0, 0, 0.4) !important;
  }

  .expand-search-box input {
    min-width: 0;
    flex: 1;
    font-size: 0.9rem;
    padding: 8px 0;
  }

  .expand-replace-row .expand-search-box {
    background: rgba(139, 92, 246, 0.1) !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
    border-radius: 10px !important;
  }

  .expand-replace-btns,
  .expand-search-nav {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
  }

  .expand-action-btn {
    height: 28px;
    font-size: 0.7rem;
    padding: 0 10px;
    width: auto !important;
  }

  .expand-body {
    flex-direction: column;
    height: 65vh !important;
    /* Fixed: Increased height for more editing space */
    min-height: 480px;
  }

  .expand-pane-right {
    border-left: none !important;
    border-top: 1px solid var(--glass-border);
  }

  .expand-footer {
    flex-direction: column;
    padding: 1rem;
    gap: 12px;
    align-items: stretch;
  }

  .expand-stats {
    justify-content: center;
    order: 2;
    font-size: 0.65rem !important;
    opacity: 0.5;
  }

  .expand-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    order: 1;
  }

  .expand-footer-actions button {
    width: 100%;
    justify-content: center;
    padding: 10px !important;
    font-size: 0.8rem !important;
  }
}

@media (max-width: 480px) {
  .qa-stat-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Specific adjustment for workspace finalize button (Always Below Name) */
#workspaceView .header-row {
  flex-direction: column;
  align-items: stretch;
  /* Stretch for mobile, or start for desktop? user said "under" which implies column */
  gap: 20px;
  margin-bottom: 2.5rem;
}

#workspaceView .header-row div:last-child {
  display: flex;
  justify-content: flex-start;
}

#goToReviewBtn {
  width: auto;
  min-width: 280px;
  display: flex;
  justify-content: center;
  padding: 14px 30px;
  font-size: 1rem;
  height: auto;
  border-radius: 14px;
}

/* Mobile specific for workspace buttons */
@media (max-width: 640px) {
  #goToReviewBtn {
    width: 100%;
    min-width: unset;
  }
}