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

:root {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222f;
  --border: #2d2d3d;
  --text: #e4e4ed;
  --text-dim: #8888a0;
  --accent: #7c5cfc;
  --accent-hover: #6a48e8;
  --danger: #e05555;
  --success: #44b87a;
  --column-bg: #14141c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header h1 span {
  color: var(--accent);
}

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

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

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

.btn-icon {
  background: var(--surface2);
  color: var(--text-dim);
  padding: 8px;
  font-size: 18px;
  line-height: 1;
}
.btn-icon:hover { color: var(--text); background: var(--border); }

/* Kanban */
.kanban {
  overflow-x: auto;
  min-height: calc(100vh - 80px);
  display: flex;
  gap: 12px;
  padding: 20px;
  overflow-x: auto;
  min-height: calc(100vh - 64px);
  align-items: flex-start;
}

.column {
  min-width: 280px;
  max-width: 320px;
  flex: 1;
  background: var(--column-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.column-header {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.column-header .count {
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.column-body {
  padding: 8px;
  min-height: 100px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.column-body.drag-over {
  background: rgba(124, 92, 252, 0.05);
  border-radius: 0 0 12px 12px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: all 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card.dragging {
  opacity: 0.4;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 6px;
}

.card-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface2);
}

.card-badge.has-script { color: var(--text-dim); }
.card-badge.has-audio { color: var(--success); }
.card-badge.has-video { color: var(--accent); }
.card-badge.generating { color: #f0a030; }

/* Card action buttons */
.card-action-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
  color: white;
}

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

.card-action-btn.btn-ai { background: var(--accent); }
.card-action-btn.btn-ai:hover:not(:disabled) { background: var(--accent-hover); }
.card-action-btn.btn-optimize { background: #e0a020; }
.card-action-btn.btn-optimize:hover:not(:disabled) { background: #c89018; }
.card-action-btn.btn-video { background: var(--success); }
.card-action-btn.btn-video:hover:not(:disabled) { opacity: 0.9; }

/* Card inline video */
.card-video {
  margin-top: 8px;
  border-radius: 6px;
  overflow: hidden;
}

.card-video video {
  width: 100%;
  display: block;
  border-radius: 6px;
  max-height: 160px;
  background: black;
}

/* Spinner */
.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: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

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

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90vw;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }

.modal h2 {
  font-size: 18px;
  margin-bottom: 20px;
  padding-right: 32px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.form-group textarea {
  min-height: 120px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Recording */
.recording-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.recording-section h3 {
  font-size: 14px;
  margin-bottom: 12px;
}

.rec-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-record {
  background: var(--danger);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.btn-record.recording {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.rec-timer {
  font-size: 18px;
  font-family: 'SF Mono', monospace;
  color: var(--text-dim);
  min-width: 60px;
}

.waveform-container {
  height: 40px;
  background: var(--surface2);
  border-radius: 6px;
  margin-top: 10px;
  overflow: hidden;
}

.waveform-container canvas {
  width: 100%;
  height: 100%;
}

.audio-player {
  margin-top: 12px;
}

.audio-player audio {
  width: 100%;
  height: 36px;
}

.device-select {
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  max-width: 200px;
}

/* Video preview */
.video-section {
  margin-bottom: 16px;
}

.video-section video {
  width: 100%;
  border-radius: 8px;
  background: black;
}

.video-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--surface2);
  font-size: 12px;
  margin-top: 8px;
}

.video-status.processing {
  color: #f0a030;
}

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

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

.btn-delete {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  margin-left: auto;
}
.btn-delete:hover { background: var(--danger); color: white; }

.btn-generate {
  background: var(--success);
  color: white;
}
.btn-generate:hover { opacity: 0.9; }

.modal-actions .btn-ai {
  background: var(--accent);
  color: white;
}
.modal-actions .btn-ai:hover { background: var(--accent-hover); }

.modal-actions .btn-optimize {
  background: #e0a020;
  color: white;
}
.modal-actions .btn-optimize:hover { background: #c89018; }

/* Settings Modal */
.settings-modal .form-group textarea {
  min-height: 80px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Responsive */
@media (max-width: 768px) {
  .kanban {
  overflow-x: auto;
  min-height: calc(100vh - 80px); padding: 12px; gap: 8px; }
  .column { min-width: 260px; }
  .modal { width: 95vw; padding: 20px; }
}

.btn-regen {
  background: #e67e22 !important;
  color: white !important;
  margin-top: 4px;
}
.btn-regen:hover { background: #d35400 !important; }
