:root {
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Aqua Aero (Default Light - Flat & Clean) */
  --bg-gradient: #e2f1f8;
  --bg-size: auto;
  --bg-repeat: no-repeat;
  --bg-position: center;
  --ink: #0f2e46;
  --muted: #4e738e;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-hover: rgba(255, 255, 255, 0.75);
  --glass-card: rgba(255, 255, 255, 0.80);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-highlight: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 10px 25px rgba(18, 68, 102, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.9);
  --glow-color: rgba(78, 185, 241, 0.3);
  --btn-primary-bg: linear-gradient(180deg, #64cbf4 0%, #2581c4 100%);
  --btn-primary-border: #8ee1ff;
  --btn-primary-text: #ffffff;
  --tag-high-bg: rgba(255, 99, 71, 0.18);
  --tag-high-text: #bd2d13;
  --tag-low-bg: rgba(46, 204, 113, 0.18);
  --tag-low-text: #1d7a42;
  --tag-norm-bg: rgba(52, 152, 219, 0.18);
  --tag-norm-text: #186291;
}

/* DARK MODE OVERRIDES */
[data-theme="dark"] {
  --bg-gradient: #0f1823;
  --ink: #e8f4fc;
  --muted: #8caec4;
  --glass: rgba(18, 32, 48, 0.65);
  --glass-hover: rgba(26, 45, 66, 0.8);
  --glass-card: rgba(21, 38, 56, 0.85);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-highlight: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  --glow-color: rgba(42, 157, 224, 0.35);
  --btn-primary-bg: linear-gradient(180deg, #329cd8 0%, #175d93 100%);
  --btn-primary-border: #56b9f3;
  --btn-primary-text: #ffffff;
  --tag-high-bg: rgba(231, 76, 60, 0.3);
  --tag-high-text: #ff9d93;
  --tag-low-bg: rgba(46, 204, 113, 0.3);
  --tag-low-text: #8be0ad;
  --tag-norm-bg: rgba(52, 152, 219, 0.3);
  --tag-norm-text: #92d0f8;
}

/* FLAT BACKGROUND PRESETS */
[data-preset="emerald"] {
  --bg-gradient: #e3f7ef;
  --ink: #063023;
  --muted: #3a7563;
}
[data-preset="sunset"] {
  --bg-gradient: #fcece8;
  --ink: #3b121a;
  --muted: #824d58;
}
[data-preset="deepgloss"] {
  --bg-gradient: #0a1118;
  --ink: #f0f7ff;
  --muted: #82a3c0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--ink);
  background: var(--bg-gradient);
  background-size: var(--bg-size);
  background-repeat: var(--bg-repeat);
  background-position: var(--bg-position);
  background-attachment: fixed;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

.app {
  max-width: 1440px;
  margin: auto;
  padding: 24px clamp(14px, 3vw, 36px) 40px;
}

.liquid-glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  position: relative;
}

/* ADSENSE CONTAINER (Integración estética Aero) */
.ads-container {
  margin-top: 18px;
  border-radius: 20px;
  padding: 12px;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 24px;
  min-height: 56px;
  overflow: visible !important;
}

.topbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 2px;
}

.top-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex: 1;
  overflow: visible !important;
}

@media (max-width: 1024px) {
  .topbar {
    align-items: flex-start;
    padding-top: 14px;
    padding-bottom: 14px;
  }
}

.brand-title {
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.8px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

.btn, .icon-btn, .select-control {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink);
  border-radius: 14px;
  padding: 7px 11px;
  font-weight: 650;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06), inset 0 1px 1px rgba(255,255,255,0.6);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s, background 0.2s;
}

.btn:hover, .icon-btn:hover, .select-control:hover {
  transform: translateY(-1px);
  background: var(--glass-hover);
  box-shadow: 0 4px 14px var(--glow-color), inset 0 1px 2px rgba(255,255,255,0.9);
}
.btn.primary {
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-border);
  background: var(--btn-primary-bg);
  box-shadow: 0 8px 20px var(--glow-color), inset 0 1px 2px rgba(255,255,255,0.7);
}

.btn-concept-highlight {
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%) !important;
  color: #ffffff !important;
  border: 1px solid #7dd3fc !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4), inset 0 1px 1px rgba(255,255,255,0.8) !important;
  letter-spacing: 0.3px;
  padding: 6px 12px !important;
}
.btn-concept-highlight:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.6), inset 0 1px 1px #ffffff !important;
  transform: translateY(-2px) scale(1.03) !important;
}

.hero {
  margin-top: 20px;
  border-radius: 28px;
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.hero-text h1 {
  font-size: clamp(24px, 3.5vw, 36px);
  margin: 4px 0 6px;
  letter-spacing: -1.2px;
  font-weight: 800;
}
.hero-text p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.eyebrow {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 800;
  color: var(--muted);
  opacity: 0.85;
}

.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-box {
  min-width: 90px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.15);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  text-align: center;
}
.stat-box strong { display: block; font-size: 24px; font-weight: 800; }
.stat-box span { font-size: 10px; letter-spacing: 1px; color: var(--muted); font-weight: 800; text-transform: uppercase; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  flex-wrap: wrap;
}
.search-box { flex: 1; min-width: 220px; position: relative; }
.search-box input {
  width: 100%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  border-radius: 16px;
  padding: 11px 16px 11px 40px;
  font: inherit;
  font-size: 13px;
  outline: none;
  color: var(--ink) !important;
  backdrop-filter: blur(10px);
}
.search-box input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
[data-theme="dark"] .search-box input::placeholder {
  color: rgba(232, 244, 252, 0.65);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.column {
  border-radius: 26px;
  padding: 16px;
  min-height: 380px;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
}
.column.drag-over {
  background: var(--glass-hover);
  border-color: #38bdf8;
}
.col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 6px 16px;
}
.col-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.todo .status-dot { background: #f59e0b; }
.doing .status-dot { background: #3b82f6; }
.done .status-dot { background: #10b981; }

.count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255,255,255,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 3px 8px;
}

.cards-container { display: flex; flex-direction: column; gap: 14px; min-height: 250px; }

/* TASK CARD */
.task-card {
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 15px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06), inset 0 1px 1px var(--glass-highlight);
  cursor: grab;
  backdrop-filter: blur(16px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
}
.task-card:hover { transform: translateY(-3px) scale(1.01); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.card-title { font-size: 14px; font-weight: 750; margin: 0; }
.card-desc { font-size: 12px; color: var(--muted); margin: 0 0 10px; white-space: pre-wrap; }

/* CHECKLIST IN CARD */
.card-checklist {
  margin: 10px 0;
  border-top: 1px dashed var(--glass-border);
  padding-top: 8px;
}
.checklist-progress-bar {
  height: 4px;
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.checklist-progress-fill {
  height: 100%;
  background: #3b82f6;
  width: 0%;
  transition: width 0.3s ease;
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 4px;
}
.checklist-item input[type="checkbox"] { cursor: pointer; }
.checklist-item.done-item span { text-decoration: line-through; opacity: 0.6; }

.card-footer { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.card-footer-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }

.tag { font-size: 10px; font-weight: 800; border-radius: 8px; padding: 4px 8px; text-transform: uppercase; }

/* Bordes en tarjetas Kanban según prioridad */
.task-card.priority-high { border-left: 4px solid #ef4444; }
.task-card.priority-normal { border-left: 4px solid #3b82f6; }
.task-card.priority-low { border-left: 4px solid #10b981; }

/* Badges de prioridad en Kanban */
.tag.high { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.tag.normal { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.tag.low { background: rgba(16, 185, 129, 0.2); color: #10b981; }

/* Degradados en barras de Gantt por prioridad */
.gantt-bar.priority-high {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  border-color: #fca5a5;
}
.gantt-bar.priority-normal {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: #93c5fd;
}
.gantt-bar.priority-low {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
  border-color: #6ee7b7;
}

/* Indicador visual en Gantt para tareas completadas */
.gantt-bar.is-done {
  opacity: 0.55;
  filter: grayscale(40%);
}
.gantt-bar.is-done span {
  text-decoration: line-through;
}

.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-mini {
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.25);
  color: var(--ink);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-mini:hover { background: var(--glass-hover); transform: translateY(-1px); }

.col-add-btn {
  width: 100%;
  margin-top: 12px;
  border: 1px dashed var(--glass-border);
  background: var(--glass);
  border-radius: 14px;
  padding: 10px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

/* FULLSCREEN INFINITE CONCEPT BOARD MODAL */
.concept-overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(10, 20, 30, 0.75);
  backdrop-filter: blur(18px);
  z-index: 500;
  padding: 15px;
  flex-direction: column;
}
.concept-overlay.open { display: flex; }

.concept-window {
  width: 100%;
  height: 100%;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  position: relative;
}

.concept-toolbar {
  padding: 10px 18px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--glass);
  z-index: 20;
  flex-wrap: wrap;
}
.concept-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.concept-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.12) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  cursor: grab;
}
.concept-viewport:active { cursor: grabbing; }

.concept-infinite-world {
  position: absolute;
  top: 0; left: 0;
  width: 10000px; height: 10000px;
  transform-origin: 0 0;
  pointer-events: auto;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

#svgConnectionsCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

#drawCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
}
#drawCanvas.active-draw { pointer-events: auto; cursor: crosshair; }

/* CONCEPT BOARD NODES */
.concept-node {
  position: absolute;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  min-width: 160px;
  min-height: 100px;
  cursor: move;
  backdrop-filter: blur(14px);
  user-select: none;
  z-index: 3;
  resize: none !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #38bdf8;
  border: 1px solid #ffffff;
  border-radius: 2px;
  z-index: 15;
}
.resize-handle.top-left     { top: -4px; left: -4px; cursor: nwse-resize; }
.resize-handle.top-right    { top: -4px; right: -4px; cursor: nesw-resize; }
.resize-handle.bottom-left  { bottom: -4px; left: -4px; cursor: nesw-resize; }
.resize-handle.bottom-right { bottom: -4px; right: -4px; cursor: nwse-resize; }

.node-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  color: var(--ink);
}
.node-table th, .node-table td {
  border: 1px solid var(--glass-border);
  padding: 4px 6px;
  outline: none;
}
.node-table th {
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
}

.concept-node.active-node {
  z-index: 10;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4), 0 14px 35px rgba(0,0,0,0.25);
}
.concept-node.connect-source {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.6) !important;
}

.node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}
.node-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.7; }

.concept-node textarea {
  width: 100%;
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
  cursor: text;
  resize: none;
}
.concept-node img, .concept-node video, .concept-node iframe {
  width: 100%;
  height: 100%;
  flex: 1;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  pointer-events: none;
}

.swatch-box {
  width: 100%;
  flex: 1;
  min-height: 50px;
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1px solid rgba(255,255,255,0.4);
}

/* HIGH-PRECISION GANTT VIEW STYLES */
.gantt-header-cell {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  color: var(--muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--glass-border);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}
.gantt-header-cell.today-column {
  background: rgba(56, 189, 248, 0.18);
  color: #0284c7;
  border-radius: 6px 6px 0 0;
}
.gantt-row-label {
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
  display: flex;
  align-items: center;
  height: 38px;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  user-select: none;
}
.gantt-bar-wrapper {
  position: relative;
  height: 38px;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  align-items: center;
}

.gantt-cell-bg {
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.gantt-cell-bg.today {
  background: rgba(56, 189, 248, 0.06);
}

.gantt-bar {
  position: relative;
  height: 26px;
  border-radius: 8px;
  background: var(--btn-primary-bg);
  border: 1px solid var(--btn-primary-border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  user-select: none;
  z-index: 2;
  transition: box-shadow 0.2s ease, opacity 0.2s ease;
  margin: auto 0;
}

.gantt-bar:active {
  cursor: grabbing;
}
.gantt-bar:hover {
  box-shadow: 0 6px 14px var(--glow-color);
}
.gantt-bar.is-dragging {
  opacity: 0.88;
  box-shadow: 0 8px 22px rgba(0,0,0,0.3);
  z-index: 10;
}

/* Handles para estirar los bordes de la barra */
.gantt-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  cursor: ew-resize;
  background: rgba(255, 255, 255, 0.25);
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gantt-handle::after {
  content: '';
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 1px;
}
.gantt-bar:hover .gantt-handle {
  opacity: 1;
}
.gantt-handle:hover {
  background: rgba(255, 255, 255, 0.55);
}
.gantt-handle-left {
  left: 0;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
}
.gantt-handle-right {
  right: 0;
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
}

/* STANDARD MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal-card {
  width: min(520px, 100%);
  border-radius: 28px;
  padding: 26px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.close-btn { border: 1px solid var(--glass-border); background: var(--glass); color: var(--ink); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; }

.field { display: block; margin-bottom: 15px; }
.field span { display: block; font-size: 12px; font-weight: 750; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px; border: 1px solid var(--glass-border); background: var(--glass); border-radius: 14px; font: inherit; font-size: 13px; color: var(--ink); outline: none;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  opacity: 0;
  background: var(--glass-card);
  color: var(--ink);
  border: 1px solid var(--glass-border);
  padding: 12px 22px;
  border-radius: 16px;
  transition: all 0.3s;
  z-index: 600;
  font-size: 13px;
  font-weight: 650;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; }