/* ==========================================================================
   ZenBan • Premium Kanban & Todo Design System
   ========================================================================== */

:root {
  /* Color Palette - Modern Dark Slate & Vibrant Neon Accents */
  --bg-app: #0b0f17;
  --bg-viewport: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #283548;
  --bg-surface-hover: #334155;
  --bg-glass: rgba(30, 41, 59, 0.75);
  --bg-glass-heavy: rgba(15, 23, 42, 0.88);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-focus: #6366f1;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #0f172a;

  /* Brand Accents */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-light: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(99, 102, 241, 0.35);

  --accent-success: #10b981;
  --accent-success-light: rgba(16, 185, 129, 0.15);
  --accent-warning: #f59e0b;
  --accent-warning-light: rgba(245, 158, 11, 0.15);
  --accent-danger: #ef4444;
  --accent-danger-light: rgba(239, 68, 68, 0.15);
  --accent-purple: #a855f7;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 45px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);

  /* Geometry & Transitions */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light Theme Variables */
body.theme-light {
  --bg-app: #f1f5f9;
  --bg-viewport: #e2e8f0;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-heavy: rgba(255, 255, 255, 0.95);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.14);
  --border-focus: #4f46e5;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --text-inverse: #ffffff;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 35px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Base Reset & Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-app);
  user-select: none;
}

h1, h2, h3, h4, .brand-title {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* App Layout Grid */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Header & Top Controls
   ========================================================================== */
.app-header {
  height: 64px;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

/* Globo con la versión al tocar el logo */
.brand-version {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 200;
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 0.45rem 0.8rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  cursor: default;
}

.brand-version[hidden] {
  display: none;
}

.brand-version a {
  color: var(--accent-primary);
  text-decoration: none;
}

.brand-settings-btn {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-primary) 0%, #818cf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
}

.brand-title span {
  color: var(--accent-primary);
}

.brand-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Quick Stats */
.quick-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-pill {
  padding: 0.25rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-pill .stat-num {
  font-weight: 700;
  color: var(--text-main);
}

.stat-pill.completed {
  border-color: rgba(16, 185, 129, 0.3);
  background: var(--accent-success-light);
  color: var(--accent-success);
}
.stat-pill.completed .stat-num {
  color: var(--accent-success);
}

/* Header Center: Search & Filter */
.header-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  max-width: 680px;
}

.search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 2rem 0 2.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.clear-search-btn {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.filter-dropdown-wrap {
  position: relative;
}

.select-filter {
  height: 38px;
  padding: 0 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}

.select-filter:hover, .select-filter:focus {
  border-color: var(--border-medium);
  color: var(--text-main);
}

/* Header Right: Buttons */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* General Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 38px;
  padding: 0 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

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

.btn-danger {
  background: var(--accent-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Install App Button */
.btn-install {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 700;
  animation: subtlePulse 4s infinite ease-in-out;
}

.btn-install:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

.btn-install:active {
  transform: translateY(1px);
}

@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  }
  50% {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.65);
  }
}

.btn-sm {
  height: 32px;
  padding: 0 0.75rem;
  font-size: 0.78rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

/* Theme Icons Toggle */
.sun-icon { display: none; }
.moon-icon { display: block; }

body.theme-light .sun-icon { display: block; }
body.theme-light .moon-icon { display: none; }

/* ==========================================================================
   Viewport Area & Interactive Canvas (Zoom & Pan)
   ========================================================================== */
.viewport-area {
  flex: 1;
  touch-action: none; /* los gestos del dedo los maneja la app (las columnas siguen desplazándose) */
  width: 100%;
  height: calc(100vh - 64px);
  position: relative;
  overflow: hidden;
  background-color: var(--bg-viewport);
  background-image: radial-gradient(var(--border-subtle) 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: default;
}

.viewport-area.pan-mode {
  cursor: grab !important;
}

.viewport-area.is-panning {
  cursor: grabbing !important;
}

/* The Zoom Canvas element that transforms */
.zoom-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: auto;
}

/* Kanban Board Container inside Canvas */
.kanban-board {
  display: inline-flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 2rem 2.5rem 6rem 2.5rem;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  z-index: 1;
  /* El espacio vacío del tablero deja pasar clics a las imágenes de fondo */
  pointer-events: none;
}

.kanban-board > * {
  pointer-events: auto;
}

/* ==========================================================================
   Kanban Columns
   ========================================================================== */
.kanban-column {
  width: 330px;
  min-width: 330px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kanban-column:hover {
  border-color: var(--border-medium);
}

.column-header {
  padding: 1rem 1.15rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  background: var(--bg-surface-elevated);
  position: relative;
}

.column-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  background-color: var(--col-accent, var(--accent-primary));
}

.column-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
}

.column-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--col-accent, var(--accent-primary));
  box-shadow: 0 0 8px var(--col-accent, var(--accent-primary));
  flex-shrink: 0;
}

.column-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-count-badge {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.column-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.col-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

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

/* Cards Container (Droppable) */
.column-cards {
  padding: 0.85rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Custom Scrollbar for columns */
.column-cards::-webkit-scrollbar {
  width: 5px;
}
.column-cards::-webkit-scrollbar-track {
  background: transparent;
}
.column-cards::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}
.column-cards::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Drop Indicator Line */
.drop-placeholder {
  height: 64px;
  border: 2px dashed var(--accent-primary);
  border-radius: var(--radius-md);
  background: var(--accent-primary-light);
  margin-bottom: 0.25rem;
  transition: all var(--transition-fast);
  pointer-events: none;
}

/* Column Empty State */
.column-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  margin: 0.5rem 0;
  pointer-events: none;
}

.column-empty svg {
  width: 28px;
  height: 28px;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.column-empty span {
  font-size: 0.8rem;
}

/* Add Card Button at Column Bottom */
.column-footer {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-add-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem;
  background: transparent;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-add-card svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   Kanban Task Cards
   ========================================================================== */
.kanban-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  cursor: grab;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  touch-action: pan-y; /* Allows vertical scrolling inside columns on mobile, handles drag via custom touch */
}

/* Mantener presionada una tarjeta (celular): se achica un poco hasta que se toma */
.kanban-card.is-pressing {
  transform: scale(0.97);
  transition: transform 0.35s ease-out;
  border-color: var(--accent-primary);
}

@media (hover: none) {
  .kanban-card {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.kanban-card:active {
  cursor: grabbing;
}

/* Card Completed Status Styling */
.kanban-card.is-completed {
  opacity: 0.75;
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.3);
}

.kanban-card.is-completed .card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Dragging States */
.kanban-card.is-dragging {
  opacity: 0.35;
  transform: scale(0.97);
  box-shadow: none;
}

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  width: 300px;
  box-shadow: var(--shadow-xl), 0 0 20px var(--accent-glow);
  transform: rotate(3deg) scale(1.03);
  border-color: var(--accent-primary) !important;
  transition: none !important;
}

/* Card Header: Priority & Completion Toggle */
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-top-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.card-check-btn {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-medium);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all var(--transition-fast);
}

.card-check-btn:hover {
  border-color: var(--accent-success);
}

.kanban-card.is-completed .card-check-btn {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: #fff;
}

.card-check-btn svg {
  width: 13px;
  height: 13px;
}

/* Priority Badges */
.priority-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.priority-urgent {
  background: var(--accent-danger-light);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.priority-high {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.priority-medium {
  background: var(--accent-warning-light);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.priority-low {
  background: var(--accent-success-light);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Nota: sin prioridad, estilo neutro */
.priority-note {
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-medium);
}

.card-menu-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: var(--radius-xs);
  line-height: 1;
}

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

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

/* Card Content */
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  word-break: break-word;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Subtasks Progress Bar inside Card */
.card-subtasks {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--bg-surface);
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.subtasks-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.subtasks-info svg {
  width: 12px;
  height: 12px;
  vertical-align: middle;
  margin-right: 0.2rem;
}

.subtasks-progress-track {
  width: 100%;
  height: 4px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.subtasks-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-success) 100%);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

/* Card Footer: Tags & Due Date */
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.card-due-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.card-due-date svg {
  width: 12px;
  height: 12px;
}

.card-due-date.is-overdue {
  color: var(--accent-danger);
  font-weight: 600;
}

.card-due-date.is-today {
  color: var(--accent-warning);
  font-weight: 600;
}

/* ==========================================================================
   Floating Zoom HUD Controls
   ========================================================================== */
.zoom-hud {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none; /* children enable pointer events */
}

.hud-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.45rem;
  box-shadow: var(--shadow-xl), 0 0 15px rgba(0, 0, 0, 0.4);
  gap: 0.2rem;
}

.hud-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hud-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--accent-primary);
  transform: scale(1.08);
}

.hud-btn:active {
  transform: scale(0.95);
}

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

.hud-btn svg {
  width: 18px;
  height: 18px;
}

.hud-btn-text {
  padding: 0 0.6rem;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  min-width: 58px;
  text-align: center;
}

.hud-btn-text:hover {
  background: var(--bg-surface-hover);
  color: var(--accent-primary);
}

.hud-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 0.15rem;
}

.hud-gesture-hint {
  pointer-events: auto;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  box-shadow: var(--shadow-sm);
  max-width: 320px;
  text-align: right;
  opacity: 0.85;
  transition: opacity var(--transition-fast);
}

.hud-gesture-hint:hover {
  opacity: 1;
}

.app-version {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.app-version:empty {
  display: none;
}

.app-version a {
  color: inherit;
  text-decoration: none;
}

.app-version a:hover {
  text-decoration: underline;
}

/* Mobile FAB */
.mobile-fab {
  display: none;
  position: absolute;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px var(--accent-glow);
  align-items: center;
  justify-content: center;
  z-index: 85;
  cursor: pointer;
}

.mobile-fab svg {
  width: 24px;
  height: 24px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
}

.modal-card.modal-sm {
  max-width: 420px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-main);
}

/* Modal Form Controls */
#taskForm, #columnForm, #projectForm {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

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

.form-row {
  display: flex;
  gap: 1rem;
}

.col-half {
  flex: 1;
}

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

.form-group .required {
  color: var(--accent-danger);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.form-group textarea {
  resize: vertical;
  min-height: 75px;
}

/* Subtasks Builder */
.subtask-builder {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--bg-surface-elevated);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.subtask-input-row {
  display: flex;
  gap: 0.5rem;
}

.subtask-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 160px;
  overflow-y: auto;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

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

.subtask-item .subtask-text {
  flex: 1;
  color: var(--text-main);
  word-break: break-word;
}

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

.subtask-del-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.subtask-del-btn:hover {
  color: var(--accent-danger);
}

/* Color Palette Picker */
.color-picker-palette {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-option:hover {
  transform: scale(1.15);
}

.color-option.selected {
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.spacer {
  flex: 1;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.15rem;
  font-size: 0.85rem;
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 250px;
}

.toast.toast-success {
  border-left: 4px solid var(--accent-success);
}
.toast.toast-info {
  border-left: 4px solid var(--accent-primary);
}
.toast.toast-warning {
  border-left: 4px solid var(--accent-warning);
}

/* Universal Install Guide Modal */
.install-modal-content {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.install-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-surface-elevated);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.install-hero-text h3 {
  font-size: 1.05rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.install-hero-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.install-tabs {
  display: flex;
  gap: 0.4rem;
  background: var(--bg-surface-elevated);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.install-tab-btn {
  flex: 1;
  padding: 0.5rem 0.4rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.install-tab-btn:hover {
  color: var(--text-main);
}

.install-tab-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.install-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ios-step {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--bg-surface-elevated);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.ios-step p {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.45;
}

.ios-step strong {
  color: var(--accent-primary);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   Responsive Adaptations (Móvil y Pantallas Pequeñas)
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    padding: 0 0.85rem;
    height: 56px;
  }

  .header-center {
    display: none; /* Move search / filters or collapse for sleek mobile app feel */
  }

  .btn-text-desktop {
    display: none;
  }

  .btn-text-install {
    display: none;
  }

  .btn-install {
    padding: 0 0.65rem;
  }

  .quick-stats {
    display: none;
  }

  .viewport-area {
    height: calc(100vh - 56px);
  }

  .kanban-board {
    padding: 1rem 1rem 7rem 1rem;
    gap: 1rem;
  }

  .kanban-column {
    width: 290px;
    min-width: 290px;
    max-height: calc(100vh - 140px);
  }

  .mobile-fab {
    display: flex;
  }

  .zoom-hud {
    bottom: 1rem;
    right: 50%;
    transform: translateX(50%);
    align-items: center;
  }

  .hud-gesture-hint {
    display: none; /* Keep clean on small mobile screens (la versión se ve tocando el logo) */
  }

  .modal-card {
    max-height: 94vh;
  }

  .form-row {
    flex-direction: column;
    gap: 0.85rem;
  }
}


/* ==========================================================================
   Proyectos: selector, menú y estados del tablero
   ========================================================================== */
.project-switcher {
  position: relative;
}

.project-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 40px;
  padding: 0 0.7rem 0 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  max-width: 240px;
}

.project-switcher-btn:hover,
.project-switcher-btn[aria-expanded="true"] {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
}

.project-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.project-switcher-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
}

.project-switcher-label small {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}

.project-switcher-label strong {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.project-switcher-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.project-switcher-btn[aria-expanded="true"] .project-switcher-chevron {
  transform: rotate(180deg);
}

.project-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 0.5rem;
  z-index: 500;
  animation: popIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-menu[hidden] {
  display: none;
}

.project-menu-header {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
  padding: 0.4rem 0.6rem 0.5rem;
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-item {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.project-item:hover {
  background: var(--bg-surface-hover);
}

.project-item.is-active {
  background: var(--accent-primary-light);
}

.project-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.project-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.project-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.project-item-check {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.project-item-edit {
  width: 32px;
  height: 32px;
  margin-right: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.project-item-edit:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.project-item-edit svg {
  width: 15px;
  height: 15px;
}

.project-menu-new {
  width: 100%;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  background: transparent;
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.project-menu-new:hover {
  background: var(--accent-primary-light);
  border-color: var(--accent-primary);
}

.project-menu-new svg {
  width: 16px;
  height: 16px;
}

/* Botón "Agregar columna" al final del tablero */
.add-column-tile {
  width: 280px;
  min-width: 280px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.add-column-tile:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-light);
}

.add-column-tile svg {
  width: 22px;
  height: 22px;
}

/* Proyecto sin columnas */
.board-empty {
  margin: 4rem auto 0;
  max-width: 420px;
  padding: 2.25rem 2rem;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.board-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-empty-icon svg {
  width: 28px;
  height: 28px;
}

.board-empty h3 {
  font-size: 1.15rem;
  color: var(--text-main);
}

.board-empty p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .brand-title-wrap {
    display: none;
  }

  .header-left {
    gap: 0.6rem;
    min-width: 0;
  }

  .project-switcher {
    min-width: 0;
  }

  .project-switcher-btn {
    height: 38px;
    max-width: 46vw;
  }

  .project-switcher-label small {
    display: none;
  }

  .project-switcher-label strong {
    max-width: 30vw;
  }

  .project-menu {
    position: fixed;
    top: 62px;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
  }
}

/* Checkbox para habilitar la fecha de vencimiento */
.form-group .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
}

.form-group .checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.form-group input[type="date"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Etiquetas con color y selector desplegable
   ========================================================================== */
.tag-pill.tag-colored {
  background: color-mix(in srgb, var(--tag-color) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-color) 50%, transparent);
  color: color-mix(in srgb, var(--tag-color) 70%, var(--text-main));
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.tag-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tag-picker-toggle {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem 0.4rem 0.75rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-fast);
}

.tag-picker-toggle:hover,
.tag-picker-toggle[aria-expanded="true"] {
  border-color: var(--accent-primary);
}

.tag-picker-selected {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

.tag-picker-selected .tag-pill {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
}

.tag-picker-placeholder {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.tag-chip-remove {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
  padding: 0 0.1rem;
}

.tag-chip-remove:hover {
  opacity: 1;
}

.tag-picker-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.tag-picker-toggle[aria-expanded="true"] .tag-picker-chevron {
  transform: rotate(180deg);
}

.tag-picker-panel {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: popIn 0.15s ease-out;
}

.tag-picker-panel[hidden] {
  display: none;
}

.tag-create-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.form-group .tag-create-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.tag-create-row input[type="color"],
.tag-option-color {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  cursor: pointer;
  flex-shrink: 0;
}

.tag-option-color {
  width: 28px;
  height: 28px;
}

.tag-create-row .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tag-option-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tag-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-xs);
}

.tag-option:hover {
  background: var(--bg-surface-hover);
}

.tag-option-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  min-width: 0;
}

.form-group .tag-option-main input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.tag-option-main .tag-pill {
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
}

.tag-option-delete {
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
}

.tag-option-delete:hover {
  color: var(--accent-danger);
  background: var(--accent-danger-light);
}

.tag-option-empty {
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 0.5rem 0.35rem;
}

/* Filtro activo (prioridad o etiqueta distinta de "todas") */
.select-filter.is-active {
  border-color: var(--accent-primary);
  color: var(--text-main);
  background: var(--accent-primary-light);
}

#tagFilter {
  max-width: 190px;
}

/* Reparto de espacio entre buscador y filtros */
.header-center .search-box {
  min-width: 150px;
}

.header-center .select-filter {
  padding: 0 0.6rem;
  max-width: 170px;
}

@media (max-width: 1280px) {
  .header-center .select-filter {
    max-width: 135px;
  }
}

/* Listas desplegables y controles nativos con los colores del tema */
body.theme-dark {
  color-scheme: dark;
}

body.theme-light {
  color-scheme: light;
}

select option,
select optgroup {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

select option:checked {
  background-color: var(--accent-primary);
  color: #fff;
}

/* ==========================================================================
   Imágenes de fondo del lienzo
   ========================================================================== */
.bg-image-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 0;
}

.bg-image {
  position: absolute;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 4px;
}

.bg-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.bg-image:hover {
  outline: calc(1.5px * var(--inv-zoom, 1)) dashed var(--border-medium);
  outline-offset: calc(2px * var(--inv-zoom, 1));
}

.bg-image.is-selected {
  outline: calc(2px * var(--inv-zoom, 1)) solid var(--accent-primary);
  outline-offset: calc(2px * var(--inv-zoom, 1));
}

.bg-image.is-moving {
  cursor: grabbing;
}

.bg-image-handle {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  background: var(--accent-primary);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 1000; /* siempre sobre las demás imágenes */
  transform: translate(50%, 50%) scale(var(--inv-zoom, 1));
  box-shadow: var(--shadow-sm);
}

.bg-image-toolbar {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  transform: scale(var(--inv-zoom, 1));
  transform-origin: 100% 0;
  z-index: 1000; /* siempre sobre las demás imágenes */
  gap: 2px;
  padding: 3px;
  background: var(--bg-glass-heavy);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.bg-image-toolbar button {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
}

.bg-image-toolbar button:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.bg-image-toolbar button.is-danger:hover {
  background: var(--accent-danger-light);
  color: var(--accent-danger);
}

.bg-image-toolbar svg {
  width: 16px;
  height: 16px;
}

.bg-image.is-solo .bg-image-handle {
  display: block;
}

.bg-image.is-solo .bg-image-toolbar {
  display: flex;
}

/* ----- Textos libres del lienzo ----- */
.text-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 2; /* sobre los tableros, bajo los dibujos */
}

.canvas-text {
  position: absolute;
  min-height: 1em;
  padding: 0.15em 0.25em;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-main);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 4px;
}

.canvas-text.is-selected {
  outline: calc(2px * var(--inv-zoom, 1)) solid var(--accent-primary);
  outline-offset: calc(2px * var(--inv-zoom, 1));
}

.canvas-text.is-editing {
  cursor: text;
  outline: calc(2px * var(--inv-zoom, 1)) dashed var(--accent-primary);
  outline-offset: calc(2px * var(--inv-zoom, 1));
}

.canvas-text textarea {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  font: inherit;
  line-height: inherit;
  color: inherit;
}

.canvas-text-handle {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  background: var(--accent-primary);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  transform: translate(50%, 50%) scale(var(--inv-zoom, 1));
  box-shadow: var(--shadow-sm);
}

.canvas-text.is-solo .canvas-text-handle {
  display: block;
}

.canvas-text.is-editing .canvas-text-handle {
  display: none;
}

.viewport-area.tool-text,
.viewport-area.tool-text .board-frame,
.viewport-area.tool-text .bg-image {
  cursor: text;
}

/* Mientras una imagen está seleccionada, la capa pasa al frente para editarla */
.bg-image-layer.has-selection {
  z-index: 2;
}

.viewport-area.is-drop-target {
  box-shadow: inset 0 0 0 3px var(--accent-primary);
}

/* ==========================================================================
   Imágenes en tareas
   ========================================================================== */
.card-cover {
  position: relative;
  margin-bottom: 0.65rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface-elevated);
}

.card-cover img {
  display: block;
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  pointer-events: none;
}

.card-cover-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.kanban-card.is-image-drop {
  outline: 2px dashed var(--accent-primary);
  outline-offset: 3px;
  background: var(--accent-primary-light);
}

.bg-image.is-over-card {
  opacity: 0.55;
}

.task-images {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-radius: var(--radius-sm);
  transition: box-shadow var(--transition-fast);
}

.task-images.is-drop-target {
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.task-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
}

.task-image-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface-elevated);
}

.task-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

.task-image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.task-image-remove:hover {
  background: var(--accent-danger);
}

.task-images-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: transparent;
  border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.task-images-add:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.task-images-add svg {
  width: 18px;
  height: 18px;
}

.task-images-add small {
  font-weight: 400;
  color: var(--text-dim);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
  animation: fadeIn 0.15s ease-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xl);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

/* ==========================================================================
   Caja de herramientas y capa de dibujo
   ========================================================================== */
.draw-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  z-index: 3;
  pointer-events: none;
}

.draw-layer path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewport-area.tool-pen,
.viewport-area.tool-pen * {
  cursor: crosshair !important;
}

.viewport-area.tool-eraser,
.viewport-area.tool-eraser * {
  cursor: cell !important;
}

.viewport-area.tool-pen,
.viewport-area.tool-eraser {
  touch-action: none;
}

.viewport-area .toolbox,
.viewport-area .toolbox * {
  cursor: pointer !important;
}

.toolbox {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 95;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.toolbox-pill,
.toolbox-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.toolbox-options[hidden] {
  display: none;
}

.tool-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

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

.tool-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.tool-btn.is-danger:hover {
  background: var(--accent-danger-light);
  color: var(--accent-danger);
}

.tool-btn svg {
  width: 20px;
  height: 20px;
}

.toolbox-divider {
  width: 24px;
  height: 1px;
  background: var(--border-medium);
  margin: 3px 0;
}

.pen-colors {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pen-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  padding: 0;
  transition: transform var(--transition-fast);
}

.pen-color:hover {
  transform: scale(1.12);
}

.pen-color.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--accent-primary);
}

#penCustomColor {
  width: 28px;
  height: 28px;
  padding: 1px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  background: transparent;
}

#penCustomColor.active {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}

.pen-sizes {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pen-size {
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
}

.pen-size:hover {
  background: var(--bg-surface-hover);
}

.pen-size.active {
  background: var(--accent-primary-light);
  outline: 1px solid var(--accent-primary);
}

.pen-size span {
  display: block;
  border-radius: 50%;
}

@media (max-width: 768px) {
  .toolbox {
    left: 0.5rem;
    top: auto;
    bottom: 5.5rem;
    transform: none;
  }

  .tool-btn {
    width: 36px;
    height: 36px;
  }
}

/* ==========================================================================
   Lienzo libre: columnas con posición propia y selección múltiple
   ========================================================================== */
.kanban-board {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.kanban-board > .kanban-column,
.kanban-board > .add-column-tile,
.kanban-board > .board-empty {
  position: absolute;
  margin: 0;
}

.kanban-board > .board-empty {
  width: 420px;
}

.column-header {
  cursor: grab;
}

.kanban-column.is-moving {
  box-shadow: var(--shadow-xl);
  opacity: 0.95;
}

.kanban-column.is-moving .column-header {
  cursor: grabbing;
}

.kanban-column.is-selected {
  outline: calc(2px * var(--inv-zoom, 1)) solid var(--accent-primary);
  outline-offset: calc(3px * var(--inv-zoom, 1));
}

.draw-layer path.is-selected {
  filter: drop-shadow(0 0 1.5px var(--accent-primary)) drop-shadow(0 0 3px var(--accent-primary));
}

.marquee-box {
  position: absolute;
  z-index: 85;
  border: 1px solid var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  border-radius: 2px;
  pointer-events: none;
}

/* ==========================================================================
   Tableros (marcos tipo Miro con columnas hijas)
   ========================================================================== */
#boardForm {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.kanban-board > .board-frame {
  position: absolute;
}

.board-frame {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0 1rem 1rem;
  background: color-mix(in srgb, var(--board-color) 6%, var(--bg-viewport));
  border: 1px solid color-mix(in srgb, var(--board-color) 35%, transparent);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  min-width: 360px;
}

.board-frame.is-selected {
  outline: calc(2px * var(--inv-zoom, 1)) solid var(--accent-primary);
  outline-offset: calc(4px * var(--inv-zoom, 1));
}

.board-frame.is-moving {
  box-shadow: var(--shadow-xl);
  cursor: grabbing;
}

.board-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0.25rem 0.1rem;
  cursor: grab;
  user-select: none;
}

.board-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--board-color);
  box-shadow: 0 0 10px var(--board-color);
  flex-shrink: 0;
}

.board-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.board-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.board-actions {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
}

.board-columns {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.board-columns .add-column-tile {
  position: static;
}

/* Arrastre de columnas */
.kanban-column.is-dragging-column {
  opacity: 0.3;
}

.column-drag-ghost {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  transform-origin: 0 0;
  max-height: 340px;
  overflow: hidden;
  opacity: 0.9;
  box-shadow: var(--shadow-xl);
  rotate: 1.5deg;
}

.column-drop-placeholder {
  width: 6px;
  align-self: stretch;
  min-height: 120px;
  border-radius: 3px;
  background: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
  flex-shrink: 0;
}

.viewport-area.is-panning,
.viewport-area.is-panning * {
  cursor: grabbing !important;
}

/* ==========================================================================
   Barra contextual (centro del encabezado)
   ========================================================================== */
.context-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0 0.25rem;
}

.context-bar::-webkit-scrollbar {
  height: 4px;
}

.ctx-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 32px;
  padding: 0 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 220px;
}

.ctx-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctx-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--text-dim);
  flex-shrink: 0;
}

.context-bar .quick-stats {
  flex-shrink: 0;
}

.context-bar .quick-stats[hidden],
.ctx-panel[hidden] {
  display: none !important;
}

.ctx-panel {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  animation: fadeIn 0.15s ease-out;
}

.ctx-panel[data-ctx="board"] {
  flex: 1;
  min-width: 0;
}

.ctx-panel[data-ctx="common"] {
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-medium);
}

.ctx-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.7rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.ctx-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ctx-btn:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
}

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

.ctx-btn.is-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.ctx-btn.is-primary:hover {
  background: var(--accent-primary-hover);
}

.ctx-btn.is-danger:hover:not(:disabled) {
  background: var(--accent-danger-light);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.ctx-range,
.ctx-color {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 36px;
  padding: 0 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.ctx-range input[type="range"] {
  width: 110px;
  accent-color: var(--accent-primary);
}

.ctx-color input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  background: transparent;
  cursor: pointer;
}

.context-bar .search-box {
  flex: 1;
  min-width: 140px;
  max-width: 280px;
}

.context-bar .select-filter {
  padding: 0 0.6rem;
  max-width: 160px;
  height: 36px;
}

.context-bar .btn {
  height: 36px;
  flex-shrink: 0;
}

/* Tablero enfocado (contexto activo) y filtros propios */
.board-frame.is-focused:not(.is-selected) {
  border-color: color-mix(in srgb, var(--board-color) 75%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--board-color) 40%, transparent), var(--shadow-lg);
}

.board-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 22px;
  padding: 0 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-primary);
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.board-filter-badge span {
  font-size: 0.9rem;
  line-height: 1;
}

@media (max-width: 1150px) {
  .ctx-panel:not([data-ctx="canvas"]) .ctx-btn:not(.is-primary) span {
    display: none;
  }
  .ctx-panel:not([data-ctx="canvas"]) .ctx-btn {
    padding: 0 0.55rem;
  }
}

@media (max-width: 768px) {
  .context-bar {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    height: 52px;
    padding: 0 0.6rem;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 99;
  }

  .ctx-btn span {
    display: none;
  }
}

/* Compactar el encabezado para que la barra contextual quepa */
.context-bar {
  scrollbar-width: thin;
}

.ctx-panel[data-ctx="board"] #ctxEditBoard span {
  display: none;
}

@media (max-width: 1600px) {
  .brand-title-wrap {
    display: none;
  }
  .btn-text-install {
    display: none;
  }
  .btn-install {
    padding: 0 0.65rem;
  }
  .context-bar .btn span,
  .ctx-panel[data-ctx="board"] .ctx-btn span {
    display: none;
  }
  .context-bar .btn {
    padding: 0 0.7rem;
  }
}

@media (max-width: 1250px) {
  .context-bar .quick-stats {
    display: none;
  }
  .context-bar .select-filter {
    max-width: 125px;
  }
  .context-bar .search-box {
    min-width: 120px;
  }
  .ctx-label {
    max-width: 150px;
  }
}

/* ==========================================================================
   Menú contextual del lienzo
   ========================================================================== */
.canvas-menu {
  position: fixed;
  z-index: 2500;
  min-width: 210px;
  padding: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: popIn 0.12s ease-out;
}

.canvas-menu[hidden] {
  display: none;
}

.canvas-menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.canvas-menu button:hover:not(:disabled) {
  background: var(--accent-primary);
  color: #fff;
}

.canvas-menu button:hover:not(:disabled) kbd {
  color: rgba(255, 255, 255, 0.85);
}

.canvas-menu button:disabled {
  opacity: 0.4;
  cursor: default;
}

.canvas-menu svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.canvas-menu span {
  flex: 1;
}

.canvas-menu kbd {
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.canvas-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border-subtle);
}

/* ==========================================================================
   Cuenta de Google y estado de sincronización
   ========================================================================== */
.account-area {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  gap: 0.5rem;
}

.btn-google:hover {
  background: #f8f9fa;
}

.g-logo {
  width: 18px;
  height: 18px;
}

.account-chip {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  background: var(--accent-primary);
  cursor: pointer;
}

.account-chip[hidden],
.btn-google[hidden],
.account-menu[hidden] {
  display: none;
}

.account-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sync-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--bg-app);
  background: var(--text-dim);
}

.sync-dot[data-status="ok"] { background: var(--accent-success); }
.sync-dot[data-status="syncing"] { background: var(--accent-primary); animation: syncPulse 1s ease-in-out infinite; }
.sync-dot[data-status="pending"],
.sync-dot[data-status="expired"] { background: var(--accent-warning); }
.sync-dot[data-status="offline"],
.sync-dot[data-status="error"] { background: var(--accent-danger); }

@keyframes syncPulse {
  50% { transform: scale(0.7); opacity: 0.6; }
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  padding: 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  animation: popIn 0.15s ease-out;
}

.account-menu-user {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.account-menu-user strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

.account-menu-user small {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-menu-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.25rem 0.4rem;
}

.account-menu-btn {
  padding: 0.55rem 0.6rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

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

.account-menu-btn.is-danger:hover {
  background: var(--accent-danger-light);
  color: var(--accent-danger);
}

#settingsForm,
#googleSetupForm {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setup-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.setup-text code {
  background: var(--bg-surface-elevated);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--text-main);
  word-break: break-all;
}

@media (max-width: 1600px) {
  .btn-google-text {
    display: none;
  }
  .btn-google {
    padding: 0 0.65rem;
  }
}

/* ==========================================================================
   Tarjeta recién soltada: rebota y brilla para ver dónde quedó
   ========================================================================== */
.kanban-card.just-dropped {
  animation:
    card-drop-bounce 0.9s cubic-bezier(0.28, 0.84, 0.42, 1) both,
    card-drop-glow 1.6s ease-out both;
}

@keyframes card-drop-bounce {
  0%   { transform: translateY(0) scale(1); }
  18%  { transform: translateY(-10px) scale(1.04); }
  36%  { transform: translateY(0) scale(0.99); }
  52%  { transform: translateY(-5px) scale(1.02); }
  68%  { transform: translateY(0) scale(1); }
  82%  { transform: translateY(-2px); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes card-drop-glow {
  0%, 45% {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 45%, transparent), var(--shadow-md);
  }
  100% {
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kanban-card.just-dropped {
    animation: card-drop-glow 1.6s ease-out both;
  }
}

/* ==========================================================================
   Herramientas que se esconden solas (Configuración)
   ========================================================================== */
.autohide-on {
  transition: opacity 0.3s ease;
}

.autohide-on.is-autohidden {
  opacity: var(--tools-hidden-opacity, 0.2);
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.settings-range-label {
  display: block;
  margin-top: 12px;
}

#settingToolsOpacity {
  width: 100%;
  accent-color: var(--accent-primary);
}

#settingToolsOpacity:disabled {
  opacity: 0.45;
}
