:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-surface: #1e293b;
  --bg-surface-hover: #293548;
  --border-color: #334155;
  --border-focus: #6366f1;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --accent-purple: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  --modal-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAVBAR */
.navbar {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.65rem;
  background: var(--border-color);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.nav-tab.active {
  color: #fff;
  background: var(--primary);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-role-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.user-avatar {
  font-size: 1.1rem;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.select-role-picker {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.select-role-picker option {
  background: var(--bg-surface);
  color: var(--text-main);
}

.user-role-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-light);
  width: fit-content;
}

.user-role-tag.client {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.user-role-tag.qa {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.user-role-tag.dev {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.select-custom {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
}

/* TOP KPI BAR */
.kpi-banner {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-surface);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.kpi-card .kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.kpi-card .kpi-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.kpi-progress {
  width: 100%;
  height: 5px;
  background: var(--bg-primary);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.kpi-progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

/* KANBAN BOARD CONTAINER */
.board-wrapper {
  flex: 1;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-x: auto;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.board-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-col-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.btn-col-action:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* CONTROLES DE ZOOM */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
}

.btn-zoom {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-zoom:hover {
  background: var(--primary);
  color: #fff;
}

.btn-zoom.reset {
  font-weight: 700;
  color: var(--text-muted);
}

.zoom-level-badge {
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-light);
  min-width: 42px;
  text-align: center;
}

/* KANBAN EN FILA ÚNICA CONTINUA (NUNCA EN FILAS) */
.kanban-columns {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: calc(1rem * var(--board-zoom, 1));
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 1.5rem;
  scroll-behavior: smooth;
  width: 100%;
}

.kanban-col {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  flex: 0 0 calc(290px * var(--board-zoom, 1));
  width: calc(290px * var(--board-zoom, 1));
  min-width: calc(290px * var(--board-zoom, 1));
  max-width: calc(290px * var(--board-zoom, 1));
  max-height: calc(100vh - 220px);
  box-sizing: border-box;
}

.col-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.col-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.col-count {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 600;
}

.col-cards {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  min-height: 120px;
}

/* CARDS */
.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: grab;
  transition: all 0.15s ease;
  user-select: none;
}

.task-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface-hover);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.type-STORY { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.type-TASK { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.type-SUBTASK { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.type-TEST_CASE { background: rgba(6, 182, 212, 0.2); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.4); }
.type-BUG { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.type-EPIC { background: rgba(139, 92, 246, 0.25); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.4); }

.card-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.priority-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.prio-HIGH { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.prio-URGENT { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.prio-MEDIUM { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.prio-LOW { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.card-dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-primary);
}

.date-badge.overdue {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  font-weight: 700;
}

.card-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-primary);
  border-radius: 99px;
  margin: 0 8px;
  overflow: hidden;
}

.card-progress-fill {
  height: 100%;
  background: var(--success);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.avatar-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.btn-log-quick {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 7px;
  font-size: 0.72rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-log-quick:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* FLOATING TIMER WIDGET */
.live-timer-bar {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e1b4b;
  border: 1px solid var(--accent-purple);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 100;
  display: none;
}

.timer-digits {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #c084fc;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--modal-shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
}

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

.ai-challenge-box {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  font-size: 0.8rem;
  color: #d8b4fe;
}

/* MODAL DETALLE DE TARJETA & COMENTARIOS */
.modal-detail-wide {
  max-width: 720px;
  width: 95%;
}

.modal-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.modal-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.modal-tab-btn.active {
  color: #fff;
  background: var(--primary);
}

.modal-tab-content {
  display: none;
  animation: fadeIn 0.15s ease;
}

.modal-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-footer-sticky {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}

/* HILO DE COMENTARIOS */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.comment-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.comment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.comment-author {
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

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

.comment-body {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.4;
  white-space: pre-wrap;
}

/* FILTROS MIS HORAS (MULTI-TABLERO) */
.my-hours-filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.select-filter-sm, .input-filter-sm {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  outline: none;
}

.select-filter-sm:focus, .input-filter-sm:focus {
  border-color: var(--primary);
}

.filter-actions-group {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
}

.btn-apply-filter {
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.filter-admin-actions {
  display: flex;
  align-items: flex-end;
  margin-left: auto;
}

/* MARKDOWN TOGGLE Y PREVIEW */
.desc-mode-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-desc-mode {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-desc-mode.active {
  background: var(--primary);
  color: #fff;
}

.markdown-preview-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  min-height: 120px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-main);
  overflow-y: auto;
}

.markdown-preview-box code {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-family: monospace;
}

.markdown-preview-box pre {
  background: #0f172a;
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
}

/* CHECKLIST DE SUBTAREAS */
.subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.subtask-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.subtask-item.completed span.subtask-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subtask-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.subtask-text {
  font-size: 0.85rem;
  flex: 1;
}

/* LISTA DE ADJUNTOS */
.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
}

.attachment-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.attachment-name {
  font-weight: 600;
  color: var(--text-main);
}

.attachment-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}
