.text-split {
  --accent-cyan: #00d4ff;
  --accent-cyan-dim: rgba(0, 212, 255, 0.15);
  --accent-cyan-glow: rgba(0, 212, 255, 0.4);
  --bg-elevated: #0f1117;
  --bg-card: #161920;
  --bg-hover: #1c2029;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 212, 255, 0.3);
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  padding: 28px 32px;
}

/* Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.header-left {
  position: relative;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 6px 0 0;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.split-btn {
  background: transparent !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  color: #a78bfa !important;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.25s ease;
}

.split-btn:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.15) !important;
  border-color: rgba(139, 92, 246, 0.6) !important;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
}

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

.generate-btn {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 50%, #00d4ff 100%) !important;
  border: none !important;
  color: #030407 !important;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
  transition: all 0.25s ease;
}

.generate-btn:hover:not(:disabled) {
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.45);
  transform: translateY(-2px);
}

.generate-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: linear-gradient(135deg, #374151 0%, #4b5563 100%) !important;
  box-shadow: none;
  transform: none;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.25s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
  cursor: pointer;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px var(--accent-cyan-dim);
}

.stat-card.active::before {
  opacity: 1;
}

.stat-card.active .stat-glow {
  opacity: 0.5;
}

.stat-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.stat-card:hover .stat-glow {
  opacity: 0.5;
}

/* Stat variations */
.stat-total {
  --stat-color: #818cf8;
}

.stat-total::before {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.stat-total .stat-glow {
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.3), transparent 50%);
}

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

.stat-completed::before {
  background: linear-gradient(90deg, #16a34a, var(--success));
}

.stat-completed .stat-glow {
  background: radial-gradient(circle at 30% 30%, rgba(34, 197, 94, 0.3), transparent 50%);
}

.stat-processing {
  --stat-color: var(--warning);
}

.stat-processing::before {
  background: linear-gradient(90deg, #d97706, var(--warning));
}

.stat-processing .stat-glow {
  background: radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.3), transparent 50%);
}

.stat-chunks {
  --stat-color: var(--accent-cyan);
}

.stat-chunks::before {
  background: linear-gradient(90deg, #0891b2, var(--accent-cyan));
}

.stat-chunks .stat-glow {
  background: radial-gradient(circle at 30% 30%, rgba(0, 212, 255, 0.3), transparent 50%);
}

.stat-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  z-index: 1;
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  color: var(--stat-color);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
  line-height: 1.1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Content Area */
.content-area {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  min-height: 450px;
}

.empty-illustration {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 28px;
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(0, 212, 255, 0.2);
}

.orbit-1 {
  inset: 10px;
  animation: orbit-rotate 20s linear infinite;
}

.orbit-2 {
  inset: 30px;
  border-color: rgba(0, 212, 255, 0.15);
  animation: orbit-rotate 15s linear infinite reverse;
}

.orbit-3 {
  inset: 50px;
  border-color: rgba(0, 212, 255, 0.1);
  animation: orbit-rotate 10s linear infinite;
}

@keyframes orbit-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.empty-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--accent-cyan);
  box-shadow: 0 0 40px var(--accent-cyan-dim);
}

.empty-title {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

/* Files Table */
.files-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.table-select .select-all {
  --el-checkbox-text-color: var(--text-secondary);
}

.selected-text {
  color: var(--accent-cyan);
  font-weight: 500;
}

.batch-clear-btn {
  background: transparent !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.batch-clear-btn:hover {
  background: var(--danger) !important;
  color: white !important;
}

.files-list {
  max-height: 500px;
  overflow-y: auto;
}

.file-row {
  display: grid;
  grid-template-columns: 40px 50px 1fr 80px 100px 120px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.file-row:hover {
  background: var(--bg-hover);
}

.file-row.is-selected {
  background: rgba(0, 212, 255, 0.05);
}

.file-row.is-processing {
  background: rgba(245, 158, 11, 0.03);
}

.file-row.is-processing:hover {
  background: rgba(245, 158, 11, 0.08);
}

.col-select {
  display: flex;
  justify-content: center;
}

.col-icon {
  display: flex;
  justify-content: center;
}

.file-type-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.col-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

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

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

.col-status {
  display: flex;
  justify-content: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.processing {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.status-badge.success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.status-badge.pending {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

.col-action {
  color: var(--text-muted);
  display: flex;
  justify-content: center;
}

.file-row:hover .col-action {
  color: var(--accent-cyan);
}

.col-operations {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.op-btn {
  color: var(--text-muted) !important;
  transition: all 0.15s ease;
}

.op-btn:hover {
  color: var(--accent-cyan) !important;
  background: var(--accent-cyan-dim) !important;
}

.op-btn.delete:hover {
  color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========================================
   Split Dialog - Cyber Terminal Style
   ======================================== */

.dialog-fade-enter-active,
.dialog-fade-leave-active {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dialog-fade-enter-from,
.dialog-fade-leave-to {
  opacity: 0;
}

.dialog-fade-enter-from .split-dialog,
.dialog-fade-leave-to .split-dialog {
  transform: scale(0.95) translateY(20px);
  opacity: 0;
}

.split-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  padding: 20px;
  overflow-y: auto;
}

.split-dialog {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  background: linear-gradient(180deg, #0a0e14 0%, #0d1219 100%);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.1),
    0 25px 50px -12px rgba(0, 0, 0, 0.8),
    0 0 80px -20px rgba(0, 212, 255, 0.3);
}

.generate-dialog-shell {
  max-width: 760px;
  max-height: min(92vh, 920px);
}

/* Header */
.dialog-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid rgba(0, 212, 255, 0.15);
}

.header-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 10px;
  color: #00d4ff;
}

.header-icon svg {
  width: 22px;
  height: 22px;
}

.header-text {
  flex: 1;
}

.header-text h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  letter-spacing: -0.02em;
}

.header-sub {
  font-size: 12px;
  color: rgba(0, 212, 255, 0.7);
  font-family: 'JetBrains Mono', monospace;
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

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

/* Body */
.dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Method Selector */
.method-selector {
  position: relative;
}

.method-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(0, 212, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'JetBrains Mono', monospace;
}

.label-icon {
  font-size: 8px;
  color: #00d4ff;
}

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

.method-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.method-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
}

.method-btn:hover {
  border-color: rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.05);
}

.method-btn:hover::before {
  opacity: 1;
}

.method-btn.active {
  border-color: #00d4ff;
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.method-btn.active::before {
  opacity: 1;
}

.method-name {
  font-size: 12px;
  font-weight: 500;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
}

.method-tag {
  font-size: 9px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}

.method-btn.active .method-tag {
  background: rgba(0, 212, 255, 0.2);
  color: #00d4ff;
}

/* Params Panel */
.params-panel {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
}

.panel-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.param-section {
  position: relative;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.param-section:last-child {
  border-bottom: none;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-num {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(0, 212, 255, 0.5);
  font-weight: 600;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', monospace;
}

.section-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 212, 255, 0.15);
  color: #00d4ff;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.section-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.param-row:last-child {
  margin-bottom: 0;
}

.param-row.full {
  flex-direction: column;
  align-items: stretch;
}

.param-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.param-name {
  font-size: 12px;
  font-weight: 500;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
}

.param-desc {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
}

.param-control {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 200px;
}

.param-control.full {
  max-width: none;
}

.generate-dialog-shell .params-panel {
  background:
    linear-gradient(180deg, rgba(5, 10, 18, 0.92), rgba(7, 12, 21, 0.86)),
    rgba(0, 0, 0, 0.35);
}

.generate-dialog-shell .dialog-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 24px;
}

.generate-dialog-shell .param-section {
  padding: 20px 22px;
}

.generate-dialog-shell .param-row {
  margin-bottom: 0;
}

.generate-dialog-shell .param-row + .param-row {
  margin-top: 16px;
}

.generate-dialog-shell .param-info {
  gap: 6px;
}

.generate-dialog-shell .param-desc {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.46);
}

/* Cyber Slider */
.cyber-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
}

.cyber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #00d4ff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  transition: all 0.2s;
}

.cyber-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
}

.cyber-slider.accent::-webkit-slider-thumb {
  background: #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.cyber-slider.accent::-webkit-slider-thumb:hover {
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.8);
}

.param-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 60px;
  justify-content: flex-end;
}

.value-num {
  font-size: 16px;
  font-weight: 700;
  color: #00d4ff;
  font-family: 'JetBrains Mono', monospace;
}

.value-unit {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  font-family: 'JetBrains Mono', monospace;
}

.param-value.accent .value-num {
  color: #a855f7;
}

/* Chunk Preview */
.chunk-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.preview-label {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

.preview-bars {
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-bar {
  height: 8px;
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.4) 0%, rgba(0, 212, 255, 0.1) 100%);
  border-radius: 2px;
  border: 1px solid rgba(0, 212, 255, 0.3);
}

/* Overlap Preview */
.overlap-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.overlap-block {
  height: 20px;
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.4) 0%, rgba(0, 212, 255, 0.15) 100%);
  border-radius: 3px;
  border: 1px solid rgba(0, 212, 255, 0.4);
}

.overlap-zone {
  height: 20px;
  background: repeating-linear-gradient(
    45deg,
    rgba(168, 85, 247, 0.2),
    rgba(168, 85, 247, 0.2) 2px,
    transparent 2px,
    transparent 6px
  );
  border-radius: 3px;
  border: 1px dashed rgba(168, 85, 247, 0.5);
}

/* Cyber Input */
.cyber-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: all 0.2s;
}

.cyber-input:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.cyber-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* Cyber Select */
.cyber-select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.cyber-select:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.cyber-select option {
  background: #0d1219;
  color: #ffffff;
}

.generate-model-select {
  width: 100%;
}

.generate-option {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 0;
}

.generate-option__title {
  font-size: 13px;
  font-weight: 600;
  color: #eefaff;
}

.generate-option__meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.42);
}

.generate-strategy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.strategy-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    rgba(8, 13, 22, 0.92);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.strategy-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 212, 255, 0.26);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.strategy-card.active {
  border-color: rgba(0, 212, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(0, 212, 255, 0.09), rgba(255, 255, 255, 0.02)),
    rgba(8, 13, 22, 0.95);
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.08), 0 16px 36px rgba(0, 0, 0, 0.26);
}

.strategy-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.strategy-card__title {
  font-size: 14px;
  font-weight: 600;
  color: #f4fbff;
}

.strategy-card__desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.46);
  flex: 1;
}

.strategy-card__state {
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.strategy-card.active .strategy-card__state {
  color: #d8fbff;
  background: rgba(0, 212, 255, 0.14);
}

.strategy-card__switch {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.strategy-card__switch.active {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.88), rgba(0, 212, 255, 0.88));
  border-color: rgba(0, 212, 255, 0.3);
}

.strategy-card__switch-handle {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f8feff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.26);
  transition: transform 0.2s ease;
}

.strategy-card__switch.active .strategy-card__switch-handle {
  transform: translateX(20px);
}

.generate-prompt-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.generate-prompt-info {
  min-width: 0;
}

.generate-prompt-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 14px;
}

.generate-prompt-textarea {
  display: block;
  width: 100%;
  min-width: 0;
  height: 240px;
  min-height: 240px;
  max-height: 240px;
  padding: 16px 18px;
  line-height: 1.75;
  border-radius: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    rgba(6, 10, 18, 0.95);
  resize: none;
}

/* API Section */
.api-section {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, transparent 50%);
}

.api-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.api-grid .param-row.full {
  grid-column: 1 / -1;
}

.embedding-empty-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.text-link-btn {
  border: none;
  background: transparent;
  color: #00d4ff;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.text-link-btn:hover {
  color: #3be0ff;
}

/* Footer */
.dialog-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-cancel,
.btn-confirm {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'JetBrains Mono', monospace;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-confirm {
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  border: none;
  color: #030407;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.btn-confirm:hover {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
  transform: translateY(-1px);
}

.btn-confirm.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 14px;
  height: 14px;
}

.btn-loading {
  display: flex;
  gap: 4px;
}

.loading-dot {
  width: 6px;
  height: 6px;
  background: #030407;
  border-radius: 50%;
  animation: loading-bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Scrollbar */
.dialog-body::-webkit-scrollbar {
  width: 6px;
}

.dialog-body::-webkit-scrollbar-track {
  background: transparent;
}

.dialog-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.dialog-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 640px) {
  .method-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .param-row {
    flex-direction: column;
    align-items: stretch;
  }

  .param-control {
    max-width: none;
  }

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

  .embedding-empty-hint {
    align-items: flex-start;
    flex-direction: column;
  }

  .generate-strategy-grid {
    grid-template-columns: 1fr;
  }
}

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

  .file-row {
    grid-template-columns: 40px 1fr 60px;
  }

  .col-chunks,
  .col-status,
  .col-operations,
  .col-select {
    display: none;
  }

  .generate-dialog-shell {
    max-width: none;
    width: 100%;
    max-height: none;
    min-height: calc(100vh - 40px);
  }
}

:deep(.generate-model-select .el-select__wrapper) {
  min-height: 48px;
  padding: 0 14px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

:deep(.generate-model-select .el-select__wrapper.is-focused) {
  box-shadow:
    inset 0 0 0 1px rgba(0, 212, 255, 0.45),
    0 0 0 3px rgba(0, 212, 255, 0.12);
}

:deep(.generate-model-select .el-select__placeholder) {
  color: rgba(255, 255, 255, 0.28);
}

:deep(.generate-model-select .el-select__selected-item) {
  color: #f1fbff;
  font-size: 13px;
}

:deep(.generate-model-select .el-select__caret) {
  color: rgba(255, 255, 255, 0.52);
  transition: transform 0.22s ease, color 0.2s ease;
}

:global(.generate-model-dropdown.el-popper) {
  border: 1px solid rgba(0, 212, 255, 0.14);
  background: rgba(9, 13, 22, 0.98);
  border-radius: 14px;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.46);
  overflow: hidden;
}

:global(.generate-model-dropdown .el-popper__arrow::before) {
  background: rgba(9, 13, 22, 0.98);
  border-color: rgba(0, 212, 255, 0.14);
}

:global(.generate-model-dropdown .el-select-dropdown__item) {
  height: auto;
  min-height: 56px;
  padding: 10px 14px;
  color: #eefaff;
  transition: background 0.18s ease, color 0.18s ease;
}

:global(.generate-model-dropdown .el-select-dropdown__item.hover),
:global(.generate-model-dropdown .el-select-dropdown__item:hover) {
  background: rgba(0, 212, 255, 0.08);
}

:global(.generate-model-dropdown .el-select-dropdown__item.is-selected) {
  background: rgba(0, 212, 255, 0.14);
  color: #d8fbff;
}

/* Chunk Preview Dialog */
.chunk-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.chunk-preview-dialog {
  background: var(--bg-elevated);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 24px;
  width: min(96vw, 1560px);
  height: min(92vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  position: relative;
}

.chunk-preview-dialog::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(0, 212, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 24%);
  pointer-events: none;
}

.chunk-preview-dialog .dialog-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.chunk-preview-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) auto auto auto;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    rgba(7, 10, 16, 0.7);
  align-items: end;
}

.preview-search,
.preview-jump {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-search-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.preview-filter-group {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  gap: 4px;
}

.preview-filter-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-filter-btn.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22), rgba(14, 165, 233, 0.26));
  color: #d8fbff;
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.2);
}

.preview-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
  color: var(--text-secondary);
  font-size: 12px;
}

.chunk-preview-dialog .dialog-body.chunk-workspace {
  flex: 1;
  overflow: hidden;
  padding: 20px 24px 24px;
}

.chunk-workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  height: 100%;
}

.chunk-nav-panel,
.chunk-editor-panel {
  min-height: 0;
}

.chunk-nav-panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(8, 12, 20, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  overflow: hidden;
}

.chunk-nav-list {
  height: 100%;
  overflow-y: auto;
  padding: 12px;
}

.chunk-nav-item {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  border-radius: 16px;
  padding: 14px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}

.chunk-nav-item:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.22);
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.chunk-nav-item.active {
  border-color: rgba(0, 212, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12), 0 12px 32px rgba(0, 0, 0, 0.24);
}

.chunk-nav-item.modified {
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.14);
}

.chunk-nav-item:last-child {
  margin-bottom: 0;
}

.chunk-nav-meta,
.chunk-nav-footer,
.chunk-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chunk-nav-index {
  font-size: 13px;
  font-weight: 700;
  color: #d8fbff;
}

.chunk-nav-words,
.chunk-nav-status {
  font-size: 12px;
  color: var(--text-muted);
}

.chunk-nav-status {
  color: #9ad8e6;
}

.chunk-nav-item.modified .chunk-nav-status {
  color: #fbbf24;
}

.chunk-nav-snippet {
  margin: 10px 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chunk-editor-panel {
  overflow: hidden;
  padding-right: 4px;
}

.chunk-item {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    rgba(12, 17, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 22px;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chunk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.chunk-index {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.chunk-words {
  font-size: 13px;
  color: var(--text-muted);
}

.chunk-state-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chunk-state-pill.modified {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.chunk-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.form-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.cyber-input,
.cyber-textarea {
  box-sizing: border-box;
  max-width: 100%;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.cyber-input:focus,
.cyber-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.cyber-textarea {
  resize: none;
  min-height: 140px;
}

.preview-editor {
  flex: 1;
  min-height: 0;
  height: 100%;
  line-height: 1.7;
  font-size: 14px;
  overflow-y: auto;
}

.chunk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.btn-secondary {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(0, 212, 255, 0.22);
  color: #d8fbff;
}

.btn-save {
  padding: 10px 18px;
  background: linear-gradient(135deg, #0891b2, #06b6d4, #22d3ee);
  border: none;
  border-radius: 8px;
  color: #03131a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-save:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(34, 211, 238, 0.28);
}

.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-save.loading {
  pointer-events: none;
}

.btn-delete {
  padding: 10px 18px;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.42);
  color: #fecaca;
}

.btn-delete:disabled,
.btn-delete.loading {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.loading-state {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chunk-empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 8px;
  color: var(--text-secondary);
}

@media (max-width: 1180px) {
  .chunk-preview-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .preview-stats {
    justify-self: start;
  }

  .chunk-workspace-grid {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .chunk-preview-dialog {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .chunk-preview-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .preview-filter-group,
  .preview-stats {
    justify-self: start;
  }

  .chunk-preview-dialog .dialog-body.chunk-workspace {
    overflow-y: auto;
  }

  .chunk-workspace-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .chunk-nav-panel {
    max-height: 280px;
  }

  .chunk-editor-panel {
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 640px) {
  .chunk-preview-overlay {
    padding: 10px;
  }

  .chunk-preview-dialog .dialog-header,
  .chunk-preview-toolbar,
  .chunk-preview-dialog .dialog-body.chunk-workspace {
    padding-left: 16px;
    padding-right: 16px;
  }

  .chunk-item {
    padding: 16px;
  }

  .chunk-header,
  .chunk-header-main,
  .chunk-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}
