:root {
  color-scheme: dark;
  --bg-main: #0c131f;
  --bg-card: #131d2e;
  --bg-card-hover: #1a263c;
  --bg-input: #0d1524;
  --border-color: #24334a;
  --border-light: #334460;
  
  --text-primary: #e2e8f0;
  --text-secondary: #8b9cb3;
  --text-muted: #5e7088;

  --accent-primary: #38bdf8;
  --accent-primary-hover: #0284c7;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
  
  --status-pending: #fbbf24;
  --status-progress: #38bdf8;
  --status-bloqueada: #f87171;
  --status-completed: #34d399;
  --status-cancelled: #64748b;

  --priority-alta: #f43f5e;
  --priority-media: #fbbf24;
  --priority-baja: #34d399;

  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 10px -2px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  height: 100dvh;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header Principal Compacto y Minimalista */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 48px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
  z-index: 500;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  background: var(--accent-gradient);
  color: #0c131f;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}

.header-brand h1 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.brand-subtext {
  font-size: 0.90rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  background-color: rgba(251, 191, 36, 0.12);
  color: var(--status-pending);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.status-badge.connected {
  background-color: rgba(52, 211, 153, 0.12);
  color: var(--status-completed);
  border-color: rgba(52, 211, 153, 0.25);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Layout Principal (Split-View) */
.main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  height: calc(100vh - 48px);
  height: calc(100dvh - 48px);
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-panel {
  width: 460px;
  min-width: 320px;
  max-width: 80vw;
  border-right: none;
  background-color: #131d31;
  flex-shrink: 0;
}

.resizer-horizontal {
  width: 6px;
  background-color: var(--border-color);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background-color 0.2s, width 0.15s;
  position: relative;
  z-index: 20;
  user-select: none;
}

.resizer-horizontal:hover, .resizer-horizontal.dragging {
  background-color: var(--accent-primary);
  width: 8px;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.tasks-panel {
  flex: 1;
  background-color: var(--bg-main);
  padding: 14px 20px;
  overflow-y: auto;
  min-width: 400px;
}

/* Panel Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.tasks-panel .panel-header {
  background: transparent;
  padding: 0 0 12px 0;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-avatar, .tasks-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.panel-caption {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Sugerencias Rápidas */
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  background-color: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-color);
}

.chip-prompt {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.chip-prompt:hover {
  background: var(--bg-card-hover);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Historial de Chat */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-bubble {
  max-width: 96%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.user {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.bubble-meta {
  font-size: 0.68rem;
  margin-top: 6px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bubble-content p {
  margin-bottom: 8px;
}
.bubble-content p:last-child {
  margin-bottom: 0;
}
.bubble-content ul, .bubble-content ol {
  padding-left: 18px;
  margin-bottom: 8px;
}
.bubble-content code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.82em;
}

/* Tablas Markdown bien formateadas en el Chat */
.bubble-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.8rem;
  overflow-x: auto;
  display: block;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.bubble-content table th {
  background-color: rgba(30, 41, 59, 0.95);
  color: var(--accent-primary);
  font-weight: 600;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.bubble-content table td {
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  vertical-align: top;
  line-height: 1.4;
}

.bubble-content table tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.bubble-content table tr:hover {
  background-color: rgba(56, 189, 248, 0.06);
}

.bubble-content h1, .bubble-content h2, .bubble-content h3, .bubble-content h4 {
  margin: 10px 0 6px 0;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.bubble-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 12px 0;
}

/* Acciones ejecutadas por Gemini */
.action-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 6px;
}

/* Input de Chat */
.chat-input-area {
  padding: 12px 16px;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent-primary);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
}

.input-footer {
  margin-top: 6px;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.72rem;
}

kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: monospace;
}

/* Panel de Tareas: Micro-KPIs Estilo Linear */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  min-height: 38px;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.35px;
  display: block;
}

.stat-value {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1;
  display: block;
}

.stat-card.pending .stat-value { color: var(--status-pending); }
.stat-card.in-progress .stat-value { color: var(--status-progress); }
.stat-card.completed .stat-value { color: var(--status-completed); }

.stat-card.blocked .stat-value {
  color: #f87171;
}

.stat-card.blocked:hover {
  border-color: rgba(239, 68, 68, 0.4);
}

.stat-card.blocked.has-blocked {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.12);
}

/* Barra de Filtros */
.filters-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px 6px 32px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent-primary);
}

.clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.05rem;
  cursor: pointer;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented-control {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.seg-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.seg-btn.active {
  background: #334155;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.select-control {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.select-control:hover, .select-control:focus {
  border-color: var(--accent-primary);
  background-color: var(--bg-card-hover);
}

/* Tabla de Tareas */
/* Tabla de Tareas con scroll interno y cabecera fija */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-y: auto;
  max-height: calc(100vh - 230px);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.tasks-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.86rem;
}

.tasks-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #172235;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 9px 12px;
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Cabeceras de columna ordenables */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, color 0.15s;
}

.sortable-th:hover {
  background-color: #223046 !important;
  color: var(--text-primary);
}

.sortable-th.active-sort {
  color: var(--accent-primary);
  background-color: #1e2c40 !important;
}

.sort-icon {
  display: inline-block;
  font-size: 0.72rem;
  margin-left: 5px;
  opacity: 0.45;
  transition: opacity 0.15s, color 0.15s;
  font-family: monospace;
}

.sortable-th:hover .sort-icon {
  opacity: 0.85;
}

.sortable-th.active-sort .sort-icon {
  opacity: 1;
  color: var(--accent-primary);
  font-weight: 700;
}

.tasks-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.tasks-table tr {
  transition: background-color 0.15s ease;
}

.tasks-table tr:hover {
  background-color: rgba(255, 255, 255, 0.035);
}

.tasks-table tr:last-child td {
  border-bottom: none;
}

/* Efecto de foco y hover en botones de acción en desktop */
.tasks-table .action-btns {
  opacity: 0.35;
  transition: opacity 0.18s ease;
}

.tasks-table tr:hover .action-btns,
.tasks-table tr:focus-within .action-btns {
  opacity: 1;
}

.tasks-table .btn-icon {
  padding: 5px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s, transform 0.15s, color 0.15s;
}

.tasks-table .btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.08);
  transform: scale(1.12);
}

/* Píldora de Proyecto en tabla y tarjeta */
.project-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.70rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.01em;
  line-height: 1.4;
  vertical-align: middle;
  transition: transform 0.12s ease;
}

.project-pill-tag:hover {
  transform: translateY(-0.5px);
}

/* Título de tarea y estado tachado */
.task-id-badge {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: rgba(56, 189, 248, 0.10);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-block;
  letter-spacing: 0.025em;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.task-id-badge:hover {
  background: rgba(56, 189, 248, 0.20);
  border-color: rgba(56, 189, 248, 0.50);
}

.cell-task-id {
  white-space: nowrap;
}

.task-title-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.task-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
  letter-spacing: 0.005em;
}

/* Resumen de subtareas y avance */
.task-subtasks-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 3px;
  user-select: none;
  width: fit-content;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}

.task-subtasks-summary:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.mini-progress-track {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.mini-progress-fill {
  display: block;
  height: 100%;
  background: var(--accent-primary, #38bdf8);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.blocked-badge-mini {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
}

tr.status-completada .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Animación para destacar tarea recién creada o modificada */
@keyframes rowPulse {
  0% { background-color: rgba(56, 189, 248, 0.45); }
  40% { background-color: rgba(56, 189, 248, 0.25); }
  100% { background-color: transparent; }
}

tr.row-highlight {
  animation: rowPulse 3s ease-out;
}

/* Botón checkbox de estado */
.status-cell-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-check-status {
  background: transparent;
  border: 2px solid var(--border-light);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-check-status:hover {
  border-color: var(--accent-primary);
}

tr.status-completada .btn-check-status {
  background-color: var(--status-completed);
  border-color: var(--status-completed);
  color: #fff;
}

tr.status-en_progreso .btn-check-status {
  border-color: var(--status-progress);
  background-color: rgba(56, 189, 248, 0.15);
}

tr.status-bloqueada {
  background-color: rgba(239, 68, 68, 0.05);
}

tr.status-bloqueada:hover {
  background-color: rgba(239, 68, 68, 0.09) !important;
}

tr.status-bloqueada .btn-check-status {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.15);
}

/* Badge de Estado con texto visible */
.status-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  background: transparent;
}

.status-badge-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.status-badge-btn.status-pendiente {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.status-badge-btn.status-en_progreso {
  background-color: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.status-badge-btn.status-bloqueada {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.status-badge-btn.status-completada {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.status-badge-btn.status-cancelada {
  background-color: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

.status-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Select Inline de Estado */
.inline-select-status {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 3px 18px 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  transition: all 0.15s ease;
  outline: none;
}

.inline-select-status:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

.inline-select-status.status-pendiente {
  background-color: rgba(245, 158, 11, 0.16);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
}

.inline-select-status.status-en_progreso {
  background-color: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

.inline-select-status.status-bloqueada {
  background-color: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.38);
}

.inline-select-status.status-completada {
  background-color: rgba(16, 185, 129, 0.16);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.35);
}

.inline-select-status.status-cancelada {
  background-color: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
}

.inline-select-status option {
  background-color: #1e293b;
  color: #f8fafc;
}

.badge.status-bloqueada {
  background-color: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.38);
}

/* Badges y Selects Inline */
.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: capitalize;
}

/* Select Inline de Prioridad */
.inline-select-priority {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 3px 20px 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: all 0.15s ease;
  outline: none;
}

.inline-select-priority:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

.inline-select-priority.badge-alta {
  background-color: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.38);
}

.inline-select-priority.badge-media {
  background-color: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.38);
}

.inline-select-priority.badge-baja {
  background-color: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.38);
}

.inline-select-priority option {
  background-color: #1e293b;
  color: #f8fafc;
}

/* Categoría Editable */
.category-tag {
  background-color: #334155;
  color: var(--text-secondary);
  padding: 4px 9px;
  font-size: 0.74rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.category-tag.editable {
  cursor: pointer;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  transition: all 0.15s ease;
}

.category-tag.editable:hover {
  background-color: #3e5069;
  color: #fff;
  border-color: var(--accent-primary);
}

.inline-input-category {
  background: #0f172a;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 6px;
  font-family: inherit;
  width: 120px;
  outline: none;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.3);
}

/* Fecha Límite Inline */
.inline-date-input {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
  color-scheme: dark;
}

.inline-date-input:hover, .inline-date-input:focus {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background-color: rgba(15, 23, 42, 0.8);
}

.inline-date-input.overdue {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
  background-color: rgba(239, 68, 68, 0.08);
  font-weight: 600;
}

/* Control de Vista de Tareas: Desktop (Tabla) vs Móvil (Tarjetas) */
.desktop-only-table {
  display: block;
}

.mobile-only-cards {
  display: none !important;
}

/* Tarjeta de Tarea en Móvil (Card-Row sin scroll horizontal) */
.mobile-task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: background-color 0.15s, border-color 0.15s;
  position: relative;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.mobile-task-card:active {
  background-color: var(--bg-card-hover);
}

.mobile-task-card.status-bloqueada {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
}

.mobile-task-card.status-completada {
  opacity: 0.72;
  border-color: rgba(16, 185, 129, 0.25);
}

.mtc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.mtc-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}

.mtc-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mtc-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.mtc-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
  width: 100%;
  min-width: 0;
}

.mtc-title.is-completed {
  text-decoration: line-through;
  color: var(--text-muted);
}

.mtc-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
  width: 100%;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mtc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  min-width: 0;
}

.mtc-footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.mtc-footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.mtc-footer .inline-select-status {
  font-size: 0.72rem;
  padding: 2px 18px 2px 6px;
  height: 26px;
}

.mtc-footer .inline-date-input {
  font-size: 0.72rem;
  padding: 2px 5px;
  height: 26px;
}

.mtc-footer .action-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

.mtc-footer .btn-icon {
  padding: 4px;
}

/* Botones y Acciones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #0f172a;
}

.btn-primary:hover {
  opacity: 0.92;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-send {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.btn-icon:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.action-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Empty State */
.empty-state {
  padding: 44px 24px;
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
  opacity: 0.85;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.empty-state h3 {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.80rem;
  color: var(--text-secondary);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.45;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 560px;
  min-width: 380px;
  max-width: 95vw;
  min-height: 400px;
  max-height: 92vh;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  resize: both; /* Permite redimensionar ancho y alto con el mouse */
  position: relative;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.modal-card::after {
  content: '◢';
  position: absolute;
  right: 4px;
  bottom: 1px;
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.6;
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-card form {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-card textarea {
  resize: vertical;
  min-height: 70px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent-primary);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: block;
  line-height: 1.4;
}

.form-hint a {
  color: var(--accent-primary);
  text-decoration: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 190px;
  z-index: 100;
  display: none;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background-color: var(--bg-card-hover);
  color: var(--accent-primary);
}

/* Input Password Wrap */
.input-password-wrap {
  position: relative;
  display: flex;
}

.btn-toggle-pwd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.success { border-color: var(--status-completed); }
.toast.error { border-color: var(--priority-alta); }

/* Scrollbars Visibles y Elegantes */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 5px;
  border: 2px solid #1e293b;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #475569 rgba(15, 23, 42, 0.7);
}

/* ==========================================================================
   CONECTIVIDAD MÓVIL (QR) & SOPORTE PWA
   ========================================================================== */
.modal-qr-card {
  max-width: 440px !important;
  width: 92vw;
  text-align: center;
}

.qr-preview-box {
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius-md);
  margin: 0 auto 16px auto;
  width: 210px;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.qr-code-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.qr-url-section {
  text-align: left;
  margin-bottom: 16px;
}

.qr-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.qr-input-group {
  display: flex;
  gap: 8px;
}

.qr-url-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: #090e17 !important;
  color: #38bdf8 !important;
  border: 1px solid #1e293b;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.qr-instructions-list {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.6);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.qr-inst-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.35;
}

.qr-badge-num {
  background: var(--accent-primary);
  color: #0f172a;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN INFERIOR MÓVIL
   ========================================================================== */
.mobile-bottom-nav {
  display: none; /* Oculta en pantallas de escritorio */
}

/* ==========================================================================
   ADAPTABILIDAD RESPONSIVE & MOBILE-FIRST (PWA)
   ========================================================================== */
@media (max-width: 820px) {
  /* Cabecera compacta móvil: altura fija, sin saltos de línea y con menú desplegable visible */
  .app-header {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 500 !important;
    background-color: var(--bg-card) !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .header-brand {
    gap: 8px;
    flex-shrink: 0;
  }

  .header-brand h1 {
    font-size: 1.15rem;
    white-space: nowrap;
    margin: 0;
  }

  /* En móvil ocultamos el subtítulo largo para que "Focus" quede impecable y nunca salte de línea */
  .brand-subtext {
    display: none !important;
  }

  .header-brand .subtitle {
    display: none !important;
  }

  .header-brand .brand-logo {
    width: 28px;
    height: 28px;
  }

  /* Selector y menú de proyectos en móvil */
  .project-selector-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 1;
    min-width: 0;
    position: relative;
    z-index: 600;
  }

  .project-dropdown {
    position: relative;
  }

  .project-active-pill {
    padding: 4px 10px;
    font-size: 0.8rem;
    max-width: 125px;
    cursor: pointer;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.95);
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation;
  }

  .project-active-pill:focus,
  .project-active-pill:active,
  .project-active-pill:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 1px var(--accent-primary) !important;
  }

  /* Ocultar el punto coloreado redundante en móvil para que quede solo emoji y nombre */
  .project-active-pill .project-dot {
    display: none !important;
  }

  .project-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
  }

  .project-dropdown-menu {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    min-width: 240px !important;
    max-width: 90vw !important;
    z-index: 1200 !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8) !important;
  }

  .project-item-btn {
    padding: 10px 14px !important;
    font-size: 0.88rem !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* Usuario en móvil */
  .user-session-wrap {
    position: relative;
    z-index: 600;
    flex-shrink: 0;
  }

  .user-pill-btn {
    padding: 4px 10px 4px 6px;
    font-size: 0.8rem;
    border-radius: 9999px;
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation;
  }

  .user-pill-btn:focus,
  .user-pill-btn:active,
  .user-pill-btn:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 1px var(--accent-primary) !important;
  }

  .user-pill-name {
    max-width: 75px !important;
  }

  .user-menu-dropdown {
    background-color: #0f172a !important;
    background: #0f172a !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    z-index: 99999 !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.95) !important;
  }

  .user-menu-info,
  .user-menu-item {
    background-color: #0f172a !important;
    opacity: 1 !important;
  }

  /* Acciones de cabecera en móvil */
  .header-actions {
    gap: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .btn-text-desktop {
    display: none !important;
  }

  /* Ocultar botones redundantes en la cabecera móvil para desaturar espacio */
  .btn-download-portable-header {
    display: none !important;
  }

  .btn-qr-header {
    display: none !important;
  }

  #emailStatusBadge {
    display: none !important;
  }

  .app-header .header-actions button[title="Configuración de la aplicación"] {
    display: none !important;
  }

  #apiKeyStatusText {
    display: none !important;
  }

  /* Ocultar el punto verde de API key en móvil para despejar la cabecera */
  #apiKeyStatus {
    display: none !important;
  }

  /* Ocultar barra superior redundante de navegación en móvil (ya está en mobile-bottom-nav) */
  .header-main-nav {
    display: none !important;
  }

  /* Ocultar barra separadora con mouse en móvil */
  #chatResizer {
    display: none !important;
  }

  /* Layout principal de la app en móvil: flexbox puro acotado al alto de la pantalla */
  .main-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden;
    position: relative;
  }

  /* Por defecto en móvil: El chat está oculto y el panel de tareas/minutas/calendario está activo a ancho completo */
  .chat-panel {
    display: none !important;
  }

  .tasks-panel {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    flex: 1;
    min-height: 0;
    overflow-y: auto !important;
    /* El scroll acelerado, combinado con filtros de pantalla completa, produce
       tiles sin repintar en algunos Samsung/Chromium. El scroll nativo moderno
       ya es fluido y evita crear una capa GPU adicional. */
    -webkit-overflow-scrolling: auto !important;
    overscroll-behavior-y: contain;
    padding: 0 !important;
  }

  #tableViewContainer,
  #calendarViewContainer,
  #minutesViewContainer {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    contain: none !important;
    transform: none !important;
    will-change: auto !important;
  }

  /* Solo cuando el usuario selecciona la pestaña de Chat (Gemini) mostramos el chat y ocultamos tareas */
  body.mobile-view-chat .chat-panel {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-view-chat .tasks-panel {
    display: none !important;
  }

  .panel-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 12px 6px 12px !important;
    gap: 8px !important;
    background: transparent !important;
    border-bottom: none !important;
  }

  .panel-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  .panel-title-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .tasks-icon {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.95rem !important;
  }

  .panel-header h2 {
    font-size: 0.92rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-weight: 700 !important;
  }

  /* En móvil el cambio Tabla/Calendario ya está en la barra inferior, ocultar switcher redundante */
  .view-switcher {
    display: none !important;
  }

  /* Botones de acción superiores: + Nueva Tarea prominente, Exportar/Importar como iconos sutiles */
  .tasks-top-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  .tasks-top-actions .btn-primary {
    padding: 6px 12px !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    border-radius: var(--radius-sm) !important;
    white-space: nowrap !important;
  }

  .tasks-top-actions .btn-secondary {
    padding: 6px 8px !important;
    font-size: 0.75rem !important;
  }

  .tasks-top-actions .btn-secondary span {
    display: none !important; /* Ocultar texto "Exportar" e "Importar" en móvil, mostrar solo iconos */
  }

  /* Micro-KPIs de Métricas en Móvil: 5 columnas simétricas */
  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 4px !important;
    padding: 0 10px 6px 10px !important;
    margin-bottom: 0 !important;
  }

  .stat-card {
    padding: 4px 6px !important;
    border-radius: var(--radius-sm) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    box-shadow: none !important;
  }

  .stat-card .stat-value {
    font-size: 1.05rem !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
  }

  .stat-card .stat-label {
    font-size: 0.62rem !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    margin-top: 2px !important;
  }

  /* Barra de Búsqueda y Filtros Compacta en Móvil */
  .filters-toolbar {
    padding: 0 12px 6px 12px !important;
    gap: 6px !important;
    margin-bottom: 4px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .search-box {
    width: 100% !important;
    min-width: 0 !important;
  }

  .search-box input {
    height: 32px !important;
    font-size: 0.8rem !important;
    padding: 4px 10px 4px 32px !important;
  }

  .search-box svg {
    left: 10px !important;
    width: 14px !important;
    height: 14px !important;
  }

  .filter-group {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 2px 10px 4px 0 !important;
  }

  .filter-group::-webkit-scrollbar {
    display: none !important;
  }

  .segmented-control {
    flex-shrink: 0 !important;
    padding: 2px !important;
  }

  .seg-btn {
    padding: 3px 8px !important;
    font-size: 0.72rem !important;
  }

  .select-control {
    height: 28px !important;
    font-size: 0.72rem !important;
    padding: 2px 6px !important;
    flex-shrink: 0 !important;
  }

  /* En móvil ocultamos la tabla desktop con scroll horizontal y mostramos las tarjetas compactas */
  .desktop-only-table,
  #tasksTable {
    display: none !important;
  }

  .mobile-only-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 0 10px 75px 10px !important;
    contain: none !important;
    transform: none !important;
    will-change: auto !important;
    isolation: auto !important;
  }

  /* Ruta de pintura conservadora para Android/Chromium. Cada tarjeta se pinta
     dentro del scroll principal, sin promoverla a una textura independiente. */
  .mobile-task-card {
    background-color: var(--bg-card) !important;
    background-image: none !important;
    contain: none !important;
    content-visibility: visible !important;
    transform: none !important;
    will-change: auto !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    isolation: auto !important;
  }

  /* Chat en Pantalla Móvil */
  .chat-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
  }

  .chat-input-area {
    flex-shrink: 0;
    padding: 8px 10px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
  }

  .chat-input-area .input-wrapper {
    padding: 6px 10px;
  }

  .chat-input-area .input-wrapper textarea {
    font-size: 16px !important; /* Previene auto-zoom molesto en navegadores móviles */
    max-height: 85px;
  }

  .input-footer {
    display: none !important; /* Elimina atajos de teclado Enter/Shift+Enter innecesarios en móvil */
  }

  /* Barra de Navegación Inferior (PWA): en flujo flexbox, nunca tapa el input */
  .mobile-bottom-nav {
    display: flex;
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    height: 56px;
    background-color: #0d1321;
    background-image: none;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-top: 1px solid var(--border-color);
    z-index: 100;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    justify-content: space-around;
    align-items: center;
    flex-shrink: 0;
    box-shadow: none;
  }

  /* Cuando el usuario enfoca el chat para escribir, ocultamos la barra de tabs para darle 100% de visibilidad al teclado */
  body.mobile-view-chat:focus-within .mobile-bottom-nav {
    display: none !important;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 0;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    touch-action: manipulation;
  }

  .mobile-nav-btn.active {
    color: var(--accent-primary);
  }

  .mobile-nav-btn.active svg {
    stroke: var(--accent-primary);
    filter: none;
  }

  /* Modales en Móvil */
  .modal-card {
    max-width: 95vw !important;
    width: 95vw !important;
    max-height: 90vh !important;
    padding: 16px !important;
    resize: none !important; /* Desactivar resize manual en táctil */
  }

  /* Los múltiples modales viven en el DOM aun estando ocultos. Evitar blur en
     sus backdrops impide reservar superficies GPU del tamaño del viewport. */
  .modal-backdrop,
  .modal-backdrop.active,
  .modal-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Toast en móvil encima de la barra */
  .toast-container {
    bottom: 70px;
    right: 12px;
    left: 12px;
  }
}

/* ==========================================================================
   PANTALLA DE ACCESO SEGURO (LOGIN MODAL)
   ========================================================================== */
.modal-login-card {
  max-width: 400px !important;
  width: 90vw;
  padding: 28px !important;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  background: #0d1522;
  text-align: left;
}

.login-header {
  text-align: center;
  margin-bottom: 20px;
}

.login-lock-icon {
  font-size: 2.4rem;
  margin-bottom: 6px;
  display: inline-block;
  animation: pulse 2s infinite;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-error-msg {
  color: #f87171;
  font-size: 0.8rem;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.12);
  border-radius: var(--radius-sm);
  border-left: 3px solid #ef4444;
}

/* ==========================================================================
   CONMUTADOR DE VISTAS (TABLA VS CALENDARIO)
   ========================================================================== */
.view-mode-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  margin-left: 14px;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.view-toggle-btn.active {
  background: #334155;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.view-toggle-btn svg {
  flex-shrink: 0;
}

/* ==========================================================================
   BARRA DE HERRAMIENTAS DEL CALENDARIO
   ========================================================================== */
.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.calendar-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 8px;
}

.calendar-month-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 150px;
  text-align: center;
  user-select: none;
  text-transform: capitalize;
}

.btn-sm {
  padding: 4px 10px !important;
  font-size: 0.76rem !important;
}

/* ==========================================================================
   VISTA 1: AGENDA CRONOLÓGICA (HOY / SEMANA / MES)
   ========================================================================== */
.calendar-agenda-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  padding-right: 6px;
}

.agenda-overdue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: #fca5a5;
  font-size: 0.84rem;
  gap: 12px;
  flex-shrink: 0;
}

.agenda-overdue-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.agenda-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.agenda-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #172235;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.agenda-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agenda-group-title.is-today {
  color: var(--accent-primary);
}

.agenda-group-count {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.agenda-cards-list {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.agenda-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  transition: background-color 0.15s ease;
  gap: 12px;
  flex-shrink: 0;
  min-height: 64px;
}

.agenda-card:last-child {
  border-bottom: none;
}

.agenda-card:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.agenda-card.is-overdue {
  border-left: 3px solid var(--priority-alta);
  background-color: rgba(239, 68, 68, 0.04);
}

.agenda-card.is-completed {
  opacity: 0.65;
}

.agenda-card.is-completed .agenda-task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.agenda-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.agenda-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.agenda-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agenda-task-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.agenda-task-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 680px;
  line-height: 1.35;
}

.agenda-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ==========================================================================
   VISTA 2: CUADRÍCULA MENSUAL (7x5)
   ========================================================================== */
.calendar-grid-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.calendar-weekdays-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #172235;
  border-bottom: 2px solid var(--border-color);
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 0;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-color);
  min-height: 440px;
}

.calendar-days-grid.is-week-mode {
  min-height: 140px;
}

.calendar-day-cell {
  background: var(--bg-card);
  min-height: 80px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background-color 0.15s ease;
  position: relative;
}

.calendar-days-grid.is-week-mode .calendar-day-cell {
  min-height: 130px;
}

.calendar-day-cell:hover {
  background: var(--bg-card-hover);
}

.calendar-day-cell.is-other-month {
  background: #131d2e;
  opacity: 0.45;
}

.calendar-day-cell.is-selected {
  outline: 2px solid var(--accent-primary);
  background: rgba(56, 189, 248, 0.08) !important;
  z-index: 5;
}

.calendar-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.calendar-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
}

.calendar-day-cell.is-today .calendar-day-num {
  background: var(--accent-primary);
  color: #0f172a;
  border-radius: 50%;
  font-weight: 800;
}

.calendar-day-badge-count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent-primary);
}

.calendar-day-pills {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  flex: 1;
}

.calendar-mini-pill {
  font-size: 0.68rem;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  font-weight: 500;
  border-left: 2px solid transparent;
}

.calendar-mini-pill.badge-alta {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-left-color: #ef4444;
}

.calendar-mini-pill.badge-media {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
  border-left-color: #f59e0b;
}

.calendar-mini-pill.badge-baja {
  background: rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
  border-left-color: #10b981;
}

.calendar-mini-pill.is-done {
  text-decoration: line-through;
  opacity: 0.5;
}

.calendar-pills-more {
  font-size: 0.65rem;
  color: var(--accent-primary);
  font-weight: 600;
  margin-top: 2px;
}

/* Detalle de tareas de un día seleccionado en la cuadrícula */
.calendar-day-detail {
  padding: 14px 16px;
  background: #111a2c;
  border-top: 2px solid var(--border-color);
  animation: fadeIn 0.2s ease-out;
}

.day-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.day-detail-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.day-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

/* ==========================================================================
   RESPONSIVE EN MÓVILES PARA CALENDARIO
   ========================================================================== */
@media (max-width: 820px) {
  .view-mode-toggle {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .calendar-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 0 12px;
  }

  .calendar-toolbar .segmented-control {
    width: 100%;
    justify-content: space-around;
  }

  .calendar-nav-group {
    justify-content: space-between;
  }

  .calendar-month-label {
    min-width: auto;
  }

  .calendar-agenda-container {
    padding: 0 12px;
    max-height: calc(100vh - 240px);
  }

  .agenda-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .agenda-card-right {
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px dashed rgba(51, 65, 85, 0.4);
  }

  .calendar-days-grid {
    min-height: 320px;
  }

  .calendar-days-grid.is-week-mode {
    min-height: 80px;
  }

  .calendar-day-cell {
    min-height: 48px;
    padding: 3px;
  }

  .calendar-days-grid.is-week-mode .calendar-day-cell {
    min-height: 70px;
  }

  /* En móviles, solo mostrar puntos de colores en vez de textos largos */
  .calendar-mini-pill span.pill-text {
    display: none;
  }

  .calendar-mini-pill {
    width: 8px;
    height: 8px;
    border-radius: 50% !important;
    padding: 0;
    display: inline-block;
    border: none !important;
  }

  .calendar-day-pills {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
  }
}

/* ==========================================================================
   MÚLTIPLES PROYECTOS: Selector y Menú Desplegable
   ========================================================================== */
.project-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.project-dropdown {
  position: relative;
}

.project-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.project-active-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.project-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.project-icon {
  font-size: 1rem;
  line-height: 1;
}

.project-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-caret {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.project-dropdown.open .project-caret {
  transform: rotate(180deg);
}

.project-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInDown 0.15s ease-out;
}

.project-dropdown.open .project-dropdown-menu {
  display: flex;
}

.project-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.4);
}

.btn-new-project-tiny {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-project-tiny:hover {
  background: var(--accent-primary);
  color: #0f172a;
}

.project-items-list {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px 0;
}

.project-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.project-item-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.project-item-btn.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-primary);
  font-weight: 600;
}

.project-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.project-item-btn:hover .project-item-actions {
  opacity: 1;
}

.btn-edit-project-tiny {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
  touch-action: manipulation;
}
.btn-edit-project-tiny:hover, .btn-edit-project-tiny:active {
  background: rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
  color: #ffffff;
}

.project-item-edit-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.project-item-edit-btn:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.45);
  transform: scale(1.08);
}

.project-default-badge {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-weight: 600;
  margin-left: 4px;
}

/* Boton de edicion rapida del proyecto actualmente activo en el topbar */
.btn-edit-active-project {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-edit-active-project:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  transform: scale(1.08);
}

/* Selector dinamico de proyecto en la Ficha de Detalle */
.detail-project-selector-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-full);
  padding: 2px 10px 2px 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.detail-project-selector-wrap:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.detail-project-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.detail-project-select {
  background: transparent;
  border: none;
  outline: none;
  color: #38bdf8;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  margin: 0;
  font-family: inherit;
  appearance: auto;
}

.detail-project-select option {
  background: #1e293b;
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 6px 10px;
}

/* Modales apilados (Stacking Context) */
#taskDetailModal {
  z-index: 1000;
}
#taskModal {
  z-index: 2500 !important;
}
#projectModal {
  z-index: 3000 !important;
}

.project-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 12px;
  opacity: 0.6;
}

.project-all-pill {
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.35);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.project-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-right: 6px;
  vertical-align: middle;
}

/* Modal de Crear / Editar Proyecto */
.modal-project-card {
  max-width: 520px;
  width: 95%;
}

.project-icon-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-icon-section-header,
.project-color-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-icon-count-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.project-icon-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.project-selected-icon-preview {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  flex-shrink: 0;
  transition: all 0.2s ease;
  overflow: hidden;
}

.project-selected-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.project-custom-icon-img {
  width: 1.18em;
  height: 1.18em;
  border-radius: 4px;
  object-fit: cover;
  display: inline-block;
  vertical-align: -0.22em;
  line-height: 1;
}

.project-upload-icon-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
}

.btn-upload-project-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
}

.btn-upload-project-icon:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
}

.project-upload-tip {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.project-custom-icon-input-wrap {
  flex: 1;
}

.project-custom-icon-input-wrap input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  padding: 4px 0;
}

.project-custom-icon-input-wrap input::placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.project-emoji-categories {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.emoji-cat-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.emoji-cat-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.emoji-cat-btn.active {
  background: var(--accent-primary);
  color: #0b1120;
  border-color: var(--accent-primary);
  font-weight: 700;
}

.emoji-picker-catalog {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
}

.emoji-picker-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.emoji-btn {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.emoji-btn:hover {
  transform: scale(1.18);
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-secondary);
  z-index: 2;
}

.emoji-btn.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transform: scale(1.08);
}

.project-color-preview-badge {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: background 0.2s ease;
}

.color-picker-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.color-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.color-btn:hover {
  transform: scale(1.18);
}

.color-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 12px currentColor;
  transform: scale(1.12);
}

.color-picker-custom-label {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-main);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.color-picker-custom-label:hover {
  border-color: var(--accent-primary);
  transform: scale(1.18);
}

.color-picker-custom-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.color-picker-custom-icon {
  font-size: 0.85rem;
  pointer-events: none;
}

/* ==========================================================================
   MODAL DE AGENDAR / ENVIAR INVITACIÓN DE CALENDARIO
   ========================================================================== */
.modal-calendar-invite-card {
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-calendar-invite-body {
  overflow-y: auto;
  flex: 1;
  padding: 16px 20px 24px 20px;
  -webkit-overflow-scrolling: touch;
}

.cal-task-summary {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.cal-summary-title {
  font-size: 1.05rem;
  color: #ffffff;
  margin: 0 0 8px 0;
  font-weight: 600;
}

.cal-summary-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cal-schedule-box {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.cal-section {
  margin-bottom: 12px;
}

.cal-section-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 10px;
}

.cal-quick-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.cal-btn-provider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.cal-btn-provider:hover {
  border-color: var(--accent-primary);
  background: rgba(56, 189, 248, 0.1);
  transform: translateY(-2px);
}

.cal-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.cal-divider::before,
.cal-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.cal-divider span {
  padding: 0 10px;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   ESTILOS DE CORREO SMTP Y ACCIÓN RÁPIDA MI CUENTA
   ========================================================================== */
.smtp-status-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  transition: all 0.2s ease;
}

.smtp-status-card.connected {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.smtp-status-card.warning {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.smtp-status-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #fff;
}

.smtp-status-card-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
  line-height: 1.4;
}

.smtp-test-result {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  animation: fadeInDown 0.2s ease;
}

.smtp-test-result.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.smtp-test-result.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Sección Mi Cuenta en Modal de Calendario */
.cal-my-account-card {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.cal-my-account-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.cal-my-account-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
}

.cal-my-account-subtitle {
  font-size: 0.74rem;
  color: var(--accent-primary);
}

.cal-my-account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cal-btn-myacc {
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-link-action {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.74rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  transition: opacity 0.15s;
}

.btn-link-action:hover {
  opacity: 0.8;
}

/* =========================================================
   Chat Multi-Sesión (Estilo Gemini Web) y Memoria Ejecutiva
   ========================================================= */

/* Barra Unificada Minimalista de Chat y Sesiones (Slim Toolbar) */
.chat-slim-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: rgba(19, 29, 46, 0.95);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
  height: 46px;
  min-height: 46px;
}

.chat-session-selector {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: rgba(13, 21, 36, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  max-width: 50%;
  min-width: 120px;
  transition: all 0.18s ease;
  user-select: none;
}

.chat-session-selector:hover {
  background: rgba(26, 38, 60, 0.9);
  border-color: rgba(56, 189, 248, 0.35);
}

.session-sparkle {
  font-size: 0.85rem;
  line-height: 1;
}

.session-active-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.chat-sessions-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-header-actions .btn-sm {
  padding: 5px 9px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  gap: 5px;
}

.btn-new-chat-slim {
  white-space: nowrap !important;
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 5px 10px !important;
  font-size: 0.78rem !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.25);
}

/* Dropdown de Sesiones */
.chat-sessions-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 12px;
  width: 320px;
  max-width: 90vw;
  background: var(--bg-card);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65);
  z-index: 100;
  margin-top: 2px;
  overflow: hidden;
  animation: fadeInDown 0.18s ease;
}

.chat-sessions-dropdown.open {
  display: block;
}

.sessions-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(13, 21, 36, 0.8);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sessions-dropdown-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}

.session-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
}

.session-dropdown-item:hover {
  background: rgba(51, 65, 85, 0.5);
}

.session-dropdown-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-left-color: var(--accent-primary);
}

.session-dropdown-item.active .session-title {
  color: var(--accent-primary);
  font-weight: 600;
}

.session-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-title {
  font-size: 0.83rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.session-item-empty {
  padding: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Menú Desplegable Genérico (Dropdown Menu & Export/Chat Options) */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
  padding: 6px 0;
  z-index: 200;
  animation: fadeInDown 0.15s ease;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: transparent !important;
  border: none !important;
  color: #e2e8f0 !important;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.dropdown-item:hover {
  background: rgba(51, 65, 85, 0.6) !important;
  color: #38bdf8 !important;
}

.dropdown-item.text-danger {
  color: #f87171 !important;
}

.dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 5px 0;
}

.chat-menu-dropdown {
  position: relative;
}

.chat-menu-dropdown .dropdown-menu {
  right: 0;
  left: auto;
}

/* Modal de Memoria Ejecutiva */
.modal-memory-card {
  border: 1px solid rgba(168, 85, 247, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(168, 85, 247, 0.15);
}

/* Botón Descargar App Portable en Header */
.btn-download-portable-header {
  text-decoration: none;
  background: rgba(56, 189, 248, 0.1) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
  gap: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-download-portable-header:hover {
  background: rgba(56, 189, 248, 0.2) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

/* Sesión de Usuario & User Pill en Header */
.user-session-wrap {
  position: relative;
  display: inline-block;
}

.user-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  color: #f1f5f9;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.user-pill-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.user-pill-avatar {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(56, 189, 248, 0.2);
  border-radius: 50%;
}

.user-pill-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background-color: #0f172a !important;
  background: #0f172a !important;
  opacity: 1 !important;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85), 0 0 16px rgba(56, 189, 248, 0.1);
  padding: 8px 0;
  z-index: 99999;
  animation: fadeInDown 0.15s ease;
}

.user-menu-dropdown.show {
  display: block;
}

.user-menu-info {
  padding: 8px 14px 10px 14px;
  background-color: #0f172a !important;
}

.user-menu-fullname {
  font-weight: 600;
  font-size: 0.9rem;
  color: #f8fafc;
}

.user-menu-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 6px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 14px;
  background-color: #0f172a !important;
  background: #0f172a !important;
  opacity: 1 !important;
  border: none;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.user-menu-item:hover {
  background: rgba(51, 65, 85, 0.5);
  color: #38bdf8;
}

.user-menu-item.text-danger {
  color: #f87171;
}

.user-menu-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* Pestañas de Login y Registro */
.auth-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  border-radius: 6px 6px 0 0;
}

.auth-tab-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.03);
}

.auth-tab-btn.active {
  color: #38bdf8;
  border-bottom: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

/* --- ESTILOS DE SUBTAREAS Y FICHA DETALLADA (FASE 1) --- */
.stat-card.blocked {
  border-left: 3px solid #f87171;
}

.stat-card.blocked .stat-value {
  color: #f87171;
}

.stat-card.blocked:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Micro-barra de avance en la tabla de tareas */
.task-subtasks-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.mini-progress-track {
  width: 50px;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.blocked-badge-mini {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
}

/* Botón expandir en fila para mobile / desktop */
.btn-open-detail {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-open-detail:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

/* Lista de Subtareas dentro del Modal */
.subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.subtask-item:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(255, 255, 255, 0.02);
}

.subtask-item.is-blocked {
  border-left: 3px solid #f87171;
  background: rgba(239, 68, 68, 0.04);
}

.subtask-item.is-completed {
  opacity: 0.75;
}

.subtask-item.is-completed .subtask-title-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subtask-status-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.subtask-status-btn.st-pendiente {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

.subtask-status-btn.st-en_curso {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.08);
}

.subtask-status-btn.st-bloqueada {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
}

.subtask-status-btn.st-completada {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.08);
}

.subtask-title-container {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subtask-title-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  word-break: break-word;
}

.subtask-blocker-note {
  font-size: 0.75rem;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 4px;
}

.subtask-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.subtask-btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.subtask-btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.subtask-btn-icon.delete:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

/* Pestañas dentro del Modal de Detalle */
.task-detail-tabs .tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.task-detail-tabs .tab-btn:hover {
  color: var(--text-primary);
}

.task-detail-tabs .tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

/* --- TIMELINE DE BITÁCORA DE DECISIONES (FASE 2) --- */
.decisions-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  padding-left: 20px;
  padding-right: 4px;
}

.decisions-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-color);
  opacity: 0.6;
}

.decision-entry {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.decision-entry:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(255, 255, 255, 0.02);
}

.decision-entry::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid var(--bg-primary);
}

.decision-entry.type-bloqueo::before {
  background: #f87171;
}

.decision-entry.type-decision::before {
  background: #a855f7;
}

.decision-entry.type-avance::before {
  background: #10b981;
}

.decision-entry.type-cambio_alcance::before {
  background: #f59e0b;
}

.decision-entry.type-nota::before {
  background: #38bdf8;
}

.decision-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  gap: 8px;
  flex-wrap: wrap;
}

.decision-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.74rem;
  padding: 2px 7px;
  border-radius: 4px;
}

.decision-type-badge.type-decision {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.decision-type-badge.type-bloqueo {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.decision-type-badge.type-avance {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.decision-type-badge.type-cambio_alcance {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.decision-type-badge.type-nota {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.decision-content {
  font-size: 0.86rem;
  color: var(--text-primary);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- TARJETAS DE MINUTAS Y COMPROMISOS (FASE 3) --- */
.minute-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}

.minute-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.minute-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.minute-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.minute-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chronology-warning-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 0.8rem;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-items-section {
  margin-top: 10px;
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
}

.action-items-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.action-item-text {
  flex: 1;
  color: var(--text-primary);
  word-break: break-word;
}

.btn-action-convert {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-action-convert:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #fff;
}

.action-converted-badge {
  color: #10b981;
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==============================================================================
   FASE 4: ASISTENCIA Y CORRELACIÓN INTELIGENTE CON GEMINI
   ============================================================================== */

.ai-suggestion-box {
  background: linear-gradient(145deg, rgba(168, 85, 247, 0.07), rgba(56, 189, 248, 0.05));
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.ai-suggestion-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ai-suggestion-box-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #c084fc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-suggestion-box-summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.ai-item-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color 0.2s;
}

.ai-item-card:hover {
  border-color: rgba(168, 85, 247, 0.4);
}

.ai-item-card.selected {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.04);
}

.ai-item-checkbox {
  margin-top: 3px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.ai-item-body {
  flex: 1;
  min-width: 0;
}

.ai-item-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.ai-item-rationale {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.ai-item-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.badge-complexity-baja {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-complexity-media {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-complexity-alta {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-order {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.ai-suggestion-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Cruce de Minutas - Dos columnas o secciones */
.ai-correlate-group {
  margin-bottom: 14px;
}

.ai-correlate-group-title {
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-correlate-group-title.personal {
  color: #38bdf8;
}

.ai-correlate-group-title.third-party {
  color: #fbbf24;
}

/* Síntesis Semanal Markdown */
.weekly-digest-body h1,
.weekly-digest-body h2,
.weekly-digest-body h3 {
  color: var(--text-primary);
  margin-top: 14px;
  margin-bottom: 8px;
  font-weight: 700;
}

.weekly-digest-body h1 {
  font-size: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.weekly-digest-body h2 {
  font-size: 1.1rem;
}

.weekly-digest-body h3 {
  font-size: 0.95rem;
}

.weekly-digest-body ul,
.weekly-digest-body ol {
  padding-left: 20px;
  margin: 6px 0;
}

.weekly-digest-body li {
  margin-bottom: 4px;
}

.weekly-digest-body p {
  margin: 6px 0;
}

.weekly-digest-body blockquote {
  border-left: 3px solid #38bdf8;
  margin: 8px 0;
  padding: 4px 12px;
  background: rgba(56, 189, 248, 0.05);
  color: var(--text-secondary);
}

.weekly-digest-body strong {
  color: var(--text-primary);
}

.ai-loading-pulse {
  display: inline-block;
  animation: pulse 1.4s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.96); }
}

/* ==========================================================================
   HUB DE MINUTAS & CONCILIACIÓN INTELIGENTE (Fase 5)
   ========================================================================== */

/* Navegación Principal en Header */
.header-main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-main);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.header-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.header-nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.header-nav-tab.active {
  color: #fff;
  background: var(--bg-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
}

.nav-badge {
  background: #f43f5e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.badge-count-tiny {
  background: var(--accent-primary);
  color: #0c131f;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  margin-left: 4px;
}

/* Contenedor de la Vista de Minutas */
.minutes-view-container {
  padding: 0 0 20px 0;
  animation: fadeIn 0.25s ease-out;
}

.minutes-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

/* Tarjeta individual de minuta */
.minute-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.minute-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.minute-card.status-unprocessed {
  border-left: 4px solid #fbbf24;
}

.minute-card.status-partially_reconciled {
  border-left: 4px solid #38bdf8;
}

.minute-card.status-fully_reconciled {
  border-left: 4px solid #34d399;
}

.minute-card.status-info_only {
  border-left: 4px solid #64748b;
  opacity: 0.85;
}

.minute-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.minute-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
}

.minute-status-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.minute-status-badge.unprocessed {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.minute-status-badge.partially_reconciled {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.minute-status-badge.fully_reconciled {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.minute-status-badge.info_only {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.minute-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.minute-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.minute-card-summary {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.minute-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  gap: 8px;
}

.minute-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Modales de Conciliación & Diff */
.reconcile-impact-banner {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
}

.reconcile-impact-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reconcile-impact-desc {
  font-size: 0.86rem;
  color: var(--text-primary);
  line-height: 1.45;
  margin: 0;
}

.reconcile-chronology-warning {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: #fde047;
}

.reconcile-actions-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.reconcile-section-header {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 16px 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reconcile-section-header .section-count {
  background: var(--border-color);
  color: var(--text-primary);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Tarjeta individual de propuesta diff */
.proposal-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.15s ease;
  position: relative;
}

.proposal-item-card:hover {
  border-color: var(--border-light);
}

.proposal-item-card.selected {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.03);
}

.proposal-item-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.proposal-checkbox {
  margin-top: 3px;
  accent-color: #38bdf8;
  width: 17px;
  height: 17px;
  cursor: pointer;
  flex-shrink: 0;
}

.proposal-content {
  flex: 1;
  min-width: 0;
}

.proposal-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.proposal-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.reconcile-confidence-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.reconcile-confidence-badge.high {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.reconcile-confidence-badge.medium {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.reconcile-confidence-badge.low {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.reconcile-evidence-quote {
  border-left: 3px solid #38bdf8;
  background: rgba(56, 189, 248, 0.06);
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 6px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.subtask-task-toggle {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 0.83rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-option-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.toggle-option-row input[type="radio"] {
  accent-color: #38bdf8;
}

.project-select-inline {
  margin-left: 20px;
  margin-top: 4px;
}

.reconcile-dirty-alert {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 10px 0;
  font-size: 0.86rem;
  color: #fca5a5;
}



/* ==========================================================================
   Soporte Multimodal y Adjuntos de Chat (Gemini Vision & Document Analysis)
   ========================================================================== */

/* Botón para adjuntar archivos */
.btn-chat-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.btn-chat-attach:hover {
  color: var(--accent-primary);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.25);
}

.btn-chat-attach:active {
  transform: scale(0.94);
}

/* Área de previsualización de adjuntos antes del envío */
.chat-attachment-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  animation: fadeIn 0.2s ease;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px 4px 4px;
  max-width: 220px;
  font-size: 0.76rem;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  position: relative;
}

.attachment-chip-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.attachment-chip-icon {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.attachment-chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.attachment-chip-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.attachment-chip-size {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.attachment-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 1rem;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.15s ease, background 0.15s ease;
  margin-left: 2px;
}

.attachment-chip-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* Indicador de Drag & Drop activo sobre el panel de chat */
.chat-drop-active {
  border-color: var(--accent-primary) !important;
  background: rgba(56, 189, 248, 0.05) !important;
  box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.25) !important;
}

/* Adjuntos renderizados dentro de las burbujas de mensaje */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.message-attachment-img {
  max-width: 240px;
  max-height: 180px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  object-fit: cover;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.message-attachment-img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.message-attachment-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.attachment-hint {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* Modal visor de imagen ampliada */
.img-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}

.img-lightbox-backdrop img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  object-fit: contain;
}

/* ==========================================================================
   ROADMAP & CRONOGRAMA DE RELEASES (MVP+12 y Perú MVP+6)
   ========================================================================== */
.roadmap-view-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.2s ease-in-out;
}

.roadmap-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.roadmap-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.roadmap-toolbar-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.roadmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.74rem;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
}

.legend-green { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.legend-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.legend-grey { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.legend-striped { background: repeating-linear-gradient(45deg, #1e293b, #1e293b 4px, #334155 4px, #334155 8px); color: #cbd5e1; border: 1px solid #475569; }
.legend-orange { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.legend-star { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }

.roadmap-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Wrapper con scroll horizontal infinito y scrollbar estilizada */
.roadmap-gantt-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 210px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: relative;
}

.roadmap-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.76rem;
  user-select: none;
}

/* Encabezados y columnas fijas */
.roadmap-th, .roadmap-td {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0;
  text-align: center;
  vertical-align: middle;
  min-width: 58px;
  max-width: 70px;
  height: 28px;
}

/* Fila de Meses (Fija superior) */
.roadmap-row-months th {
  background: #1e3a8a;
  color: #e0e7ff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 4px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Fila de Semanas (Fija superior) */
.roadmap-row-weeks th {
  background: #1e293b;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.72rem;
  padding: 4px 2px;
  position: sticky;
  top: 33px;
  z-index: 20;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

/* Columna de Actividades (Fija izquierda) */
.roadmap-col-activity-header {
  position: sticky;
  left: 0;
  z-index: 30 !important;
  background: #0f172a !important;
  color: #f8fafc !important;
  min-width: 260px !important;
  max-width: 280px !important;
  width: 260px !important;
  text-align: left !important;
  padding-left: 12px !important;
  font-weight: 700 !important;
  border-right: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.roadmap-col-activity {
  position: sticky;
  left: 0;
  z-index: 10;
  background: #0b1322;
  color: #e2e8f0;
  min-width: 260px;
  max-width: 280px;
  width: 260px;
  text-align: left;
  padding: 4px 10px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 2px solid rgba(255, 255, 255, 0.18);
  font-size: 0.75rem;
}

/* Filas separadoras de Iniciativa (Negro brillante) */
.roadmap-row-initiative td {
  background: #000000;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  left: 0;
  z-index: 12;
}

/* Filas separadoras de Subsección / Stream */
.roadmap-row-stream td {
  background: #172554;
  color: #93c5fd;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 4px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  left: 0;
  z-index: 12;
}

/* Celdas del Gantt */
.roadmap-cell {
  position: relative;
  height: 28px;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.roadmap-cell:hover {
  background-color: rgba(56, 189, 248, 0.08);
}

/* Columna de la semana actual (Hoy) */
.current-week-col {
  background-color: rgba(56, 189, 248, 0.04);
  border-left: 1px dashed rgba(56, 189, 248, 0.6) !important;
  border-right: 1px dashed rgba(56, 189, 248, 0.6) !important;
}

.roadmap-row-weeks th.current-week-col {
  background: #0369a1 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Bloques de actividades */
.roadmap-block {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  margin: 2px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.roadmap-block:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  z-index: 5;
}

/* Variantes de color de los bloques */
.block-green {
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #22c55e;
}

.block-blue {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #3b82f6;
}

.block-grey {
  background: #475569;
  color: #f1f5f9;
  border: 1px solid #64748b;
}

.block-white {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  font-weight: 700;
}

.block-orange {
  background: #ea580c;
  color: #ffffff;
  border: 1px solid #f97316;
}

.block-red {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #ef4444;
}

.block-striped {
  background: repeating-linear-gradient(45deg, #334155, #334155 5px, #1e293b 5px, #1e293b 10px);
  color: #f8fafc;
  border: 1px dashed #94a3b8;
}

.block-freeze {
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #0284c7;
  font-weight: 700;
}

.block-star {
  background: transparent;
  color: #ef4444;
  font-size: 1.15rem;
  border: none;
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.6));
}

/* Indicadores de hitos verticales (Flechas CDN y Releases) */
.roadmap-milestones-row td {
  background: #090e17;
  padding: 6px 2px;
  vertical-align: top;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.milestone-arrow-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  padding: 2px 4px;
  border-radius: 4px;
}

.milestone-arrow-card.red {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.milestone-arrow-card.orange {
  color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
}



/* ==========================================================================
   VISTA DE SEGUIMIENTO SEMANAL & SYNCS (STANDUPS, RETROS, TEMAS)
   ========================================================================== */
.syncs-view-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - 120px);
  min-height: 520px;
  overflow: hidden;
}

.syncs-layout {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 16px;
  overflow: hidden;
}

/* Barra Lateral Izquierda: Espacios de Reunión */
.syncs-sidebar {
  width: 280px;
  min-width: 260px;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.syncs-sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.syncs-sidebar-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.btn-new-space-tiny {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-new-space-tiny:hover {
  background: #38bdf8;
  color: #0c131f;
}

.syncs-spaces-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}

.sync-space-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.sync-space-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.sync-space-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.sync-space-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.sync-space-item-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.sync-space-item-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-space-item-cadence {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sync-space-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.sync-space-badge.has-blocked {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Espacio de Trabajo Principal */
.syncs-main-panel {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.syncs-space-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.015);
}

.syncs-space-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.syncs-cadence-badge {
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
}

.syncs-day-badge {
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
}

.syncs-space-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

.syncs-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Caja Rápida para Agregar Temas */
.syncs-quick-add-wrap {
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border-color);
}

.syncs-quick-input, .syncs-quick-counterpart {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.syncs-quick-input:focus, .syncs-quick-counterpart:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.25);
}

/* Barra de Filtros por Estado */
.syncs-filter-bar {
  padding: 8px 18px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.syncs-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.syncs-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.syncs-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.syncs-chip.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* Vista 1: Agenda Dinámica */
.syncs-agenda-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sync-topic-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.sync-topic-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.sync-topic-card.status-bloqueado {
  border-left: 4px solid #ef4444;
}

.sync-topic-card.status-en_seguimiento {
  border-left: 4px solid #f59e0b;
}

.sync-topic-card.status-por_discutir {
  border-left: 4px solid #38bdf8;
}

.sync-topic-card.status-resuelto {
  border-left: 4px solid #22c55e;
  opacity: 0.75;
}

.sync-topic-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.sync-topic-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sync-topic-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sync-topic-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-topic-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sync-counterpart-pill {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.sync-priority-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
}

.sync-priority-pill.prio-alta, .sync-priority-pill.prio-urgente {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.sync-priority-pill.prio-media {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.sync-priority-pill.prio-baja {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
}

.sync-last-update-snippet {
  font-size: 0.74rem;
  color: var(--text-muted);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-topic-body {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sync-topic-desc-box {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid #38bdf8;
}

/* Historial Cronológico de Avances */
.sync-history-section-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sync-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-update-entry {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sync-update-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.sync-update-content {
  color: var(--text-primary);
  line-height: 1.4;
}

.sync-update-next-step {
  font-size: 0.74rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* Caja rápida para agregar avance de hoy */
.sync-inline-update-box {
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-inline-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 6px 8px;
  resize: vertical;
  min-height: 48px;
  outline: none;
}

.sync-inline-textarea:focus {
  border-color: #38bdf8;
}

.sync-inline-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* Barra de acciones del tema */
.sync-topic-actions-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* Vista 2: Tablero Kanban */
.syncs-kanban-container {
  flex: 1;
  overflow-x: auto;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
}

.sync-kanban-col {
  flex: 1;
  min-width: 250px;
  max-width: 320px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sync-kanban-col-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.sync-kanban-cards-wrap {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.sync-kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sync-kanban-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.sync-kanban-card-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

@media (max-width: 768px) {
  .syncs-layout {
    flex-direction: column;
  }
  .syncs-sidebar {
    width: 100%;
    max-width: 100%;
    min-height: 140px;
    max-height: 180px;
  }
}


/* Chips de selección de días en reuniones */
.sync-day-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.sync-day-chip {
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.sync-day-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.sync-day-chip.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.sync-today-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.35);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  animation: pulse-sync-today 2.5s infinite ease-in-out;
}

.sync-space-item-today {
  display: inline-block;
  background: #facc15;
  color: #0f172a;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@keyframes pulse-sync-today {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.82; transform: scale(0.97); }
}


/* Bloc de Notas Libres de la Reunión (Live Notes Scratchpad) */
.sync-live-notes-card {
  margin: 12px 20px 0 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.sync-live-notes-card:focus-within {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.02);
}

.sync-live-notes-header {
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

.sync-live-notes-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sync-notes-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 4px;
}

.sync-size-btn {
  padding: 3px 6px;
  line-height: 1;
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sync-size-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-color, #38bdf8);
  background: rgba(56, 189, 248, 0.1);
}

.sync-live-notes-body {
  padding: 12px 14px 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-live-notes-body.collapsed {
  display: none;
}

.sync-live-notes-textarea {
  width: 100%;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
  transition: height 0.12s ease-out;
}

.sync-live-notes-textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Tirador / Handle de arrastre interactivo inferior */
.sync-live-notes-resizer {
  height: 9px;
  width: 100%;
  cursor: row-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background 0.15s ease;
  user-select: none;
}

.sync-live-notes-resizer:hover,
.sync-live-notes-resizer.dragging {
  background: rgba(56, 189, 248, 0.12);
}

.sync-resizer-grip {
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  transition: all 0.15s ease;
}

.sync-live-notes-resizer:hover .sync-resizer-grip,
.sync-live-notes-resizer.dragging .sync-resizer-grip {
  background: #38bdf8;
  width: 48px;
}

.sync-live-notes-card.collapsed .sync-live-notes-resizer {
  display: none;
}

/* Modo Maximizado / Pantalla Completa Focus */
.sync-live-notes-card.maximized {
  position: fixed;
  top: 55px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  background: var(--bg-card, #131d31);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  margin: 0;
  animation: syncNotesPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes syncNotesPop {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.sync-live-notes-card.maximized .sync-live-notes-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
}

.sync-live-notes-card.maximized .sync-live-notes-textarea {
  flex: 1;
  height: 100% !important;
  min-height: 250px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.sync-live-notes-card.maximized .sync-live-notes-resizer {
  display: none;
}

.sync-live-notes-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-live-notes-status {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.sync-ai-extract-btn {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.sync-ai-extract-btn:hover {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

.sync-ai-sparkle {
  display: inline-block;
  animation: pulse-sync-today 2s infinite ease-in-out;
}

/* Modal de Clasificación IA */
.ai-classification-summary {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.ai-classification-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-classification-task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.ai-classification-task-card.is-blocker {
  border-left: 3px solid #ef4444;
}

.ai-classification-task-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.ai-classification-task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-classification-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  box-sizing: border-box;
}

.ai-classification-input:focus {
  outline: none;
  border-color: #38bdf8;
}

.ai-classification-meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.76rem;
}

.ai-classification-select, .ai-classification-date {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.74rem;
}
