* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #000; font-family: 'Segoe UI', sans-serif; }
canvas { display: block; }

#legend {
  position: fixed; bottom: 20px; right: 20px;
  background: rgba(0,0,0,0.72); padding: 14px 20px;
  border-radius: 10px; color: #fff; font-size: 13px;
  backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.08);
  z-index: 10;
}
.li { display: flex; align-items: center; gap: 10px; margin: 5px 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; }
.dot.r { background: #DD3333; box-shadow: 0 0 8px #FF4444; }
.dot.g { background: #33CC33; box-shadow: 0 0 8px #44FF44; }
.dot.y { background: #DDCC33; box-shadow: 0 0 8px #FFEE44; }

#info {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  color: rgba(1, 51, 94, 0.85); font: 18px 'Segoe UI', sans-serif;
  pointer-events: none; z-index: 10;
}

/* ── CHAT PANEL ── */
#chatPanel {
  position: fixed; top: 0; left: 0; width: 340px; height: 100vh;
  background: #1e1e2e; color: #cdd6f4; z-index: 100;
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform 0.3s ease;
  border-right: 1px solid #313244;
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
}
#chatPanel.open { transform: translateX(0); }

.chat-header {
  display: flex; align-items: center; padding: 16px 18px;
  background: #181825; border-bottom: 1px solid #313244; gap: 12px;
}
.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #1e1e2e;
  flex-shrink: 0;
}
.chat-header-info { flex: 1; }
.chat-header-info h3 { font-size: 16px; color: #cdd6f4; margin-bottom: 2px; }
.chat-header-info .status-line { font-size: 11px; display: flex; align-items: center; gap: 5px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chat-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: #313244; color: #cdd6f4; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chat-close:hover { background: #45475a; }

.chat-body { flex: 1; overflow-y: auto; padding: 14px; }
.chat-body::-webkit-scrollbar { width: 4px; }
.chat-body::-webkit-scrollbar-thumb { background: #45475a; border-radius: 2px; }

.section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: #6c7086; margin: 14px 0 8px; font-weight: 600;
}
.section-label:first-child { margin-top: 0; }

.task-card {
  background: #313244; border-radius: 8px; padding: 10px 12px;
  margin-bottom: 6px; border-left: 3px solid #89b4fa;
  transition: transform 0.15s, opacity 0.15s, background 0.15s;
}
.task-card.draggable { cursor: grab; user-select: none; }
.task-card.draggable:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.4; transform: scale(0.96); }
.task-card.drag-over { background: #45475a; border-top: 2px solid #89b4fa; }
.task-card .drag-handle {
  display: inline-block; color: #6c7086; margin-right: 6px;
  font-size: 14px; vertical-align: middle; cursor: grab;
}
.task-card.active { border-left-color: #f38ba8; }
.task-card.paused { border-left-color: #fab387; opacity: 0.7; }
.task-card .task-name { font-size: 13px; font-weight: 600; }
.task-card .task-desc {
  font-size: 11px; color: #a6adc8; margin-top: 4px;
  word-break: break-word; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task-card .task-meta {
  display: flex; gap: 6px; margin-top: 5px; align-items: center; flex-wrap: wrap;
}
.task-badge {
  font-size: 9px; padding: 2px 6px; border-radius: 4px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-type { background: #313244; color: #89b4fa; border: 1px solid #45475a; }
.badge-priority-low { background: #1e3a2e; color: #a6e3a1; }
.badge-priority-medium { background: #3a341e; color: #f9e2af; }
.badge-priority-high { background: #3a2a1e; color: #fab387; }
.badge-priority-critical { background: #3a1e1e; color: #f38ba8; }
.task-card .task-status { font-size: 10px; color: #6c7086; margin-top: 3px; }
.task-card .task-imgs {
  display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap;
}
.task-card .task-imgs img {
  width: 36px; height: 36px; object-fit: cover; border-radius: 4px;
  border: 1px solid #45475a; cursor: pointer;
}
.task-actions {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.task-actions button {
  padding: 4px 10px; border-radius: 6px; border: none;
  font-size: 11px; cursor: pointer; font-weight: 500;
  transition: filter 0.15s;
}
.task-actions button:hover { filter: brightness(1.2); }
.btn-pause { background: #fab387; color: #1e1e2e; }
.btn-end { background: #a6e3a1; color: #1e1e2e; }
.btn-delete { background: #f38ba8; color: #1e1e2e; }
.btn-edit { background: #89b4fa; color: #1e1e2e; }

.no-task {
  text-align: center; padding: 20px; color: #585b70; font-size: 13px;
}

.chat-footer {
  padding: 12px; border-top: 1px solid #313244; background: #181825;
}
.add-task-btn {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px dashed #45475a;
  background: transparent; color: #89b4fa; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; display: flex; align-items: center;
  justify-content: center; gap: 6px;
}
.add-task-btn:hover { background: rgba(137,180,250,0.1); border-color: #89b4fa; }
.send-loc-hint {
  font-size: 11px; color: #585b70; margin-top: 8px; text-align: center;
  padding: 6px; background: rgba(137,180,250,0.08); border-radius: 6px;
}

/* ── JIRA MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 500; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-card {
  background: #1e1e2e; border-radius: 12px; width: 720px; max-width: 94vw;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  animation: slideUp 0.25s ease;
}

.modal-header {
  display: flex; align-items: center; padding: 18px 24px;
  border-bottom: 1px solid #313244; gap: 12px;
}
.modal-header-icon {
  width: 36px; height: 36px; border-radius: 8px; background: #89b4fa;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.modal-header h2 {
  flex: 1; font-size: 16px; font-weight: 600; color: #cdd6f4;
}
.modal-close-btn {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: #313244; color: #6c7086; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close-btn:hover { background: #45475a; color: #cdd6f4; }

.modal-body {
  flex: 1; overflow-y: auto; padding: 24px;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: #45475a; border-radius: 2px; }

.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600; color: #a6adc8;
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-label .required { color: #f38ba8; margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #313244; background: #181825; color: #cdd6f4;
  font-size: 13px; font-family: 'Segoe UI', sans-serif; outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #89b4fa;
}
.form-input::placeholder, .form-textarea::placeholder { color: #585b70; }
.form-char-count {
  font-size: 10px; color: #585b70; margin-top: 4px; text-align: right;
}

.form-select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%236c7086' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
.form-select option { background: #1e1e2e; color: #cdd6f4; }

.form-textarea {
  resize: vertical; min-height: 180px; max-height: 400px; line-height: 1.5;
}

.form-row {
  display: flex; gap: 14px;
}
.form-row .form-group { flex: 1; }

/* Image upload area */
.upload-area {
  border: 2px dashed #313244; border-radius: 8px; padding: 20px;
  text-align: center; cursor: pointer; transition: all 0.2s;
  color: #585b70; font-size: 12px;
}
.upload-area:hover { border-color: #89b4fa; background: rgba(137,180,250,0.04); }
.upload-area.drag-active { border-color: #89b4fa; background: rgba(137,180,250,0.08); }
.upload-icon { font-size: 28px; margin-bottom: 6px; display: block; }
.upload-hint { font-size: 11px; color: #45475a; margin-top: 4px; }

.preview-grid {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.preview-item {
  position: relative; width: 72px; height: 72px; border-radius: 6px;
  overflow: hidden; border: 1px solid #313244;
}
.preview-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.preview-remove {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #f38ba8; border: none;
  font-size: 12px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.preview-item:hover .preview-remove { opacity: 1; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid #313244;
}
.modal-btn {
  padding: 9px 20px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.modal-btn-cancel {
  background: #313244; color: #cdd6f4;
}
.modal-btn-cancel:hover { background: #45475a; }
.modal-btn-save {
  background: #89b4fa; color: #1e1e2e;
}
.modal-btn-save:hover { background: #74c7ec; }

/* Image lightbox */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  z-index: 600; display: none; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
  max-width: 90vw; max-height: 90vh; border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
