/* ============================================================
   EVOL HORIZONT — Sistema de productividad personal
   Paleta sobria, moderna y funcional.
   Diseño basado en variables CSS para consistencia total.
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Colores base */
  --bg:          #F8F7F5;
  --surface:     #FFFFFF;
  --surface-2:   #F3F2EF;
  --border:      #E5E3DF;
  --border-2:    #D1CEC9;
  --text:        #1A1917;
  --text-2:      #4A4845;
  --muted:       #7C7974;

  /* Identidad de paneles */
  --horizonte:   #1E3A5F;
  --horizonte-l: #EBF0F7;
  --ahora:       #C1440E;
  --ahora-l:     #FDF1EC;
  --buffer:      #3D6B40;
  --buffer-l:    #EDF4EE;

  /* Colores de acción */
  --success:     #16A34A;
  --success-l:   #DCFCE7;
  --warning:     #CA8A04;
  --warning-l:   #FEF9C3;
  --danger:      #DC2626;
  --danger-l:    #FEE2E2;

  /* Categorías */
  --cat-producto:       #3B6EA5;
  --cat-cliente:        #8B3DAE;
  --cat-operacion:      #B45309;
  --cat-administracion: #6B7280;
  --cat-idea:           #0D9488;
  --cat-espera:         #9A3412;

  /* Slots Ahora */
  --slot-critica:    #DC2626;
  --slot-importante: #CA8A04;
  --slot-corta:      #2563EB;

  /* Post-it colores por categoría */
  --postit-producto:       #D4E8FC;
  --postit-cliente:        #E8D4F8;
  --postit-operacion:      #FFF3CD;
  --postit-administracion: #E5E7EB;
  --postit-idea:           #D1FAE5;
  --postit-espera:         #FFE4CC;
  --postit-default:        #FFF9C4;

  /* Tipografía */
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:   "SF Mono", "Fira Code", monospace;

  /* Espaciado */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;

  /* Radios */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;

  /* Sombras */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.14);

  /* Transiciones */
  --t-fast: 120ms ease;
  --t-mid:  200ms ease;
}

/* ── Tema oscuro ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #1A1A1E;
  --surface:     #242428;
  --surface-2:   #2C2C31;
  --border:      #3A3A40;
  --border-2:    #4A4A52;
  --text:        #E4E3E0;
  --text-2:      #B0AEA9;
  --muted:       #8A8884;

  --horizonte:   #6BA3D8;
  --horizonte-l: #1E2A3A;
  --ahora:       #E8764A;
  --ahora-l:     #3A2118;
  --buffer:      #6AAF6D;
  --buffer-l:    #1E2E1F;

  --success:     #34D399;
  --success-l:   #0F2A1F;
  --warning:     #FACC15;
  --warning-l:   #2A2510;
  --danger:      #F87171;
  --danger-l:    #3A1515;

  --cat-producto:       #6BA3D8;
  --cat-cliente:        #B580D1;
  --cat-operacion:      #D9A04E;
  --cat-administracion: #9CA3AF;
  --cat-idea:           #2DD4BF;
  --cat-espera:         #D97744;

  --slot-critica:    #F87171;
  --slot-importante: #FACC15;
  --slot-corta:      #60A5FA;

  --postit-producto:       #1E3350;
  --postit-cliente:        #2E1E42;
  --postit-operacion:      #3A2E10;
  --postit-administracion: #2A2A30;
  --postit-idea:           #0F2E24;
  --postit-espera:         #3A2010;
  --postit-default:        #2E2A10;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.30);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.40);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.50);
}

/* ── Reset y base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

[x-cloak] { display: none !important; }

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.app-header__logo {
  font-size: 18px;
  color: var(--horizonte);
}

.app-header__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.app-header__week {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Layout principal: 3 paneles ─────────────────────────────── */
.app-main {
  padding: var(--sp-5) var(--sp-6);
  max-width: 1400px;
  margin: 0 auto;
}

.panels-grid {
  display: grid;
  grid-template-columns: 1fr 320px 280px;
  gap: var(--sp-5);
  align-items: start;
  min-height: calc(100vh - 72px);
  width: 100%;
}

/* ── Panel base ──────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.panel__header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.panel__icon {
  font-size: 18px;
  color: var(--horizonte);
}
.panel__icon--ahora  { color: var(--ahora); }
.panel__icon--buffer { color: var(--buffer); }

.panel__title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}

.panel__subtitle {
  font-size: 11px;
  color: var(--muted);
  text-transform: lowercase;
  margin-top: 1px;
}

.panel__body {
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  flex: 1;
}

.panel__footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
}

/* Acento superior por panel */
.panel--horizonte { border-top: 3px solid var(--horizonte); }
.panel--ahora     { border-top: 3px solid var(--ahora); }
.panel--buffer    { border-top: 3px solid var(--buffer); }

/* ── Secciones dentro de paneles ────────────────────────────── */
.section { display: flex; flex-direction: column; gap: var(--sp-2); }

.section__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.section__header--clickable {
  cursor: pointer;
  user-select: none;
}
.section__header--clickable:hover { color: var(--horizonte); }

.section__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex: 1;
}

.section__chevron {
  font-size: 14px;
  color: var(--muted);
  transition: transform var(--t-fast);
}
.section__chevron--open { transform: rotate(90deg); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--sp-1);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
}
.badge--success { background: var(--success-l); color: var(--success); }
.badge--warning { background: var(--warning-l); color: var(--warning); }

/* ── Dot de categoría ────────────────────────────────────────── */
.cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cat-dot--producto       { background: var(--cat-producto); }
.cat-dot--cliente        { background: var(--cat-cliente); }
.cat-dot--operacion      { background: var(--cat-operacion); }
.cat-dot--administracion { background: var(--cat-administracion); }
.cat-dot--idea           { background: var(--cat-idea); }
.cat-dot--espera         { background: var(--cat-espera); }

/* ── Tarjeta de tarea (Horizonte) — Estilo Post-it ───────────── */
.task-card {
  background: var(--postit-default);
  border: none;
  border-radius: 2px;
  padding: var(--sp-4);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  position: relative;
  box-shadow:
    2px 3px 6px rgba(0,0,0,0.12),
    0 0 1px rgba(0,0,0,0.08);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.task-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--cat-operacion);
}
.task-card:hover {
  box-shadow:
    3px 5px 12px rgba(0,0,0,0.16),
    0 0 1px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

/* Color de fondo por categoría */
.task-card[data-category="producto"]       { background: var(--postit-producto); }
.task-card[data-category="cliente"]        { background: var(--postit-cliente); }
.task-card[data-category="operacion"]      { background: var(--postit-operacion); }
.task-card[data-category="administracion"] { background: var(--postit-administracion); }
.task-card[data-category="idea"]           { background: var(--postit-idea); }
.task-card[data-category="espera"]         { background: var(--postit-espera); }

/* Franja superior por categoría */
.task-card[data-category="producto"]::before       { background: var(--cat-producto); }
.task-card[data-category="cliente"]::before        { background: var(--cat-cliente); }
.task-card[data-category="operacion"]::before      { background: var(--cat-operacion); }
.task-card[data-category="administracion"]::before { background: var(--cat-administracion); }
.task-card[data-category="idea"]::before           { background: var(--cat-idea); }
.task-card[data-category="espera"]::before         { background: var(--cat-espera); }

.task-card--blocked {
  border-left: 3px solid var(--warning);
  background: #FFF3CD !important;
}

.task-card--done {
  opacity: 0.45;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  box-shadow: 1px 2px 4px rgba(0,0,0,0.08);
}

.task-card--buffer {
  background: var(--postit-default);
  opacity: 0.85;
}
.task-card--buffer:hover { opacity: 1; }

.task-card__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }

.task-card__top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.task-card__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card__desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card__date,
.task-card__origin {
  font-size: 11px;
  color: var(--muted);
}

.task-card__block-reason {
  font-size: 11px;
  color: var(--warning);
  font-style: italic;
}

.task-card__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.task-card:hover .task-card__actions { opacity: 1; }

.task-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.task-list--done { gap: var(--sp-1); }

/* ── Slots del panel Ahora ───────────────────────────────────── */
.slot {
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.slot__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.slot__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.slot__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.slot__dot--critica    { background: var(--slot-critica); }
.slot__dot--importante { background: var(--slot-importante); }
.slot__dot--corta      { background: var(--slot-corta); }

/* Acento lateral por slot */
.slot--critica    { border-left: 3px solid var(--slot-critica); }
.slot--importante { border-left: 3px solid var(--slot-importante); }
.slot--corta      { border-left: 3px solid var(--slot-corta); }

.slot__empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.slot__empty:hover { background: var(--surface-2); }

/* ── Tarjeta de slot (panel Ahora) — Post-it prominente ───────── */
.slot-card {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--postit-default);
  position: relative;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.1);
}

.slot-card--blocked { background: #FFF3CD !important; }

/* Slot-card color por categoría */
.slot-card[data-category="producto"]       { background: var(--postit-producto); }
.slot-card[data-category="cliente"]        { background: var(--postit-cliente); }
.slot-card[data-category="operacion"]      { background: var(--postit-operacion); }
.slot-card[data-category="administracion"] { background: var(--postit-administracion); }
.slot-card[data-category="idea"]           { background: var(--postit-idea); }
.slot-card[data-category="espera"]         { background: var(--postit-espera); }

.slot-card__body { display: flex; flex-direction: column; gap: var(--sp-1); }

.slot-card__top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
}

.slot-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.slot-card__desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}

.slot-card__origin {
  font-size: 11px;
  color: var(--muted);
}

.slot-card__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── Regla del día ───────────────────────────────────────────── */
.day-rule {
  background: var(--ahora-l);
  border: 1px solid #F2C4AD;
  border-radius: var(--r-md);
  padding: var(--sp-4);
}

.day-rule__content,
.day-rule__empty {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.day-rule__icon { font-size: 14px; }

.day-rule__text {
  font-size: 13px;
  font-style: italic;
  color: var(--text-2);
  flex: 1;
  border: none;
  margin: 0;
  padding: 0;
}

.day-rule__hint {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
}

.day-rule__form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.day-rule__form-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

/* ── Objetivos de la semana ──────────────────────────────────── */
.goal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.goal-item {
  display: flex;
  flex-direction: column;
  padding: var(--sp-2);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.goal-item:hover > .goal-item__row { background: var(--surface-2); }
.goal-item:hover .goal-item__delete { opacity: 1; }

.goal-item__row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}

.goal-item--done .goal-item__text {
  text-decoration: line-through;
  color: var(--muted);
}

.goal-item__check {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--horizonte);
  width: 20px;
  flex-shrink: 0;
  padding: 0;
}

.goal-item__text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  overflow-wrap: break-word;
}

.goal-item__delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast);
  padding: 0 var(--sp-1);
}
.goal-item__delete:hover { color: var(--danger); }

/* ── Formulario inline (agregar objetivo) ────────────────────── */
.inline-form {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-top: var(--sp-1);
  flex-wrap: wrap;
}

/* ── Tareas agrupadas bajo un objetivo ───────────────────────── */
.goal-tasks {
  margin-left: var(--sp-6);
  margin-top: var(--sp-1);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  border-left: 2px solid var(--border);
  padding-left: var(--sp-3);
}

.inline-form--goal {
  margin-left: var(--sp-6);
  padding-left: var(--sp-3);
  border-left: 2px solid transparent;
}

/* ── Indicador de bloqueo ────────────────────────────────────── */
.block-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--warning);
  font-weight: 600;
  cursor: help;
}

.block-info {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--warning-l);
  border-radius: var(--r-sm);
  font-size: 12px;
}

.block-info__reason { color: var(--text-2); }

/* ── Hint vacío ──────────────────────────────────────────────── */
.empty-hint {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: var(--sp-2) 0;
}

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
}

/* Tamaños */
.btn--sm  { padding: var(--sp-1) var(--sp-3); font-size: 12px; }
.btn--xs  { padding: 2px var(--sp-2); font-size: 11px; }
.btn--full { width: 100%; }

/* Variantes */
.btn--primary {
  background: var(--horizonte);
  color: #fff;
  border-color: var(--horizonte);
}
.btn--primary:hover { background: #162d4a; }

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border-2); }

.btn--success { color: var(--success); }
.btn--success:hover { background: var(--success-l); border-color: var(--success); }

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-l); border-color: var(--danger); }

.btn--warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}
.btn--warning:hover { background: #a16207; }

/* ── Dropdown ────────────────────────────────────────────────── */
.dropdown { position: relative; }

.dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 160px;
  padding: var(--sp-1);
}

.dropdown__menu--wide { min-width: 220px; padding: var(--sp-3); }

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast);
}
.dropdown__item:hover { background: var(--surface-2); }

.dropdown__hint {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

/* ── Formularios ─────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-1); flex: 1; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--horizonte);
  box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

.form-input--sm,
.form-select--sm { padding: 4px var(--sp-2); font-size: 12px; }

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

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.modal__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--muted);
  line-height: 1;
  padding: 0 var(--sp-1);
}
.modal__close:hover { color: var(--text); }

.modal__body {
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-2);
}

.modal__footer-left { flex: 1; }
.modal__footer-right { display: flex; gap: var(--sp-2); }

/* ── Historial ───────────────────────────────────────────────── */
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: var(--sp-5);
}

.history-list::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}

.history-item {
  display: flex;
  gap: var(--sp-3);
  padding-bottom: var(--sp-4);
  position: relative;
}

.history-item__dot {
  position: absolute;
  left: calc(-1 * var(--sp-5) + 4px);
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--horizonte);
  border: 2px solid var(--surface);
  flex-shrink: 0;
}

.history-item__content { display: flex; flex-direction: column; gap: 2px; }

.history-item__states {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
}

.history-item__from {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--muted);
}

.history-item__arrow { color: var(--muted); font-size: 12px; }

.history-item__to {
  background: var(--horizonte-l);
  color: var(--horizonte);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
}

.history-item__note {
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
}

.history-item__time {
  font-size: 11px;
  color: var(--muted);
}

/* ── Papelera ────────────────────────────────────────────────── */
.trash-container {
  max-width: 800px;
  margin: 0 auto;
}

.trash-empty {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--muted);
}
.trash-empty__icon { font-size: 48px; display: block; margin-bottom: var(--sp-3); }
.trash-empty__text { font-size: 15px; }

.trash-section {
  margin-bottom: var(--sp-6);
}

.trash-section__title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.trash-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.trash-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  opacity: 0.75;
}

.trash-item__icon {
  font-size: 16px;
  flex-shrink: 0;
  padding-top: 2px;
}

.trash-item__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.trash-item__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.trash-item__desc {
  font-size: 12px;
  color: var(--text-2);
}

.trash-item__meta {
  font-size: 11px;
  color: var(--muted);
}

.trash-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  transition: color var(--t-fast);
}
.trash-link:hover { color: var(--text-2); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .panels-grid {
    grid-template-columns: 1fr;
  }
  .app-main { padding: var(--sp-4); }
}

@media (max-width: 700px) {
  .app-main { padding: var(--sp-3); }
  .app-header {
    padding: var(--sp-3) var(--sp-4);
    flex-wrap: wrap;
    height: auto;
    gap: var(--sp-2);
  }
}

/* ── Animaciones HTMX ────────────────────────────────────────── */
.htmx-swapping { opacity: 0; transition: opacity 150ms ease; }
.htmx-settling { opacity: 0; }
.htmx-settling.htmx-added { opacity: 1; transition: opacity 200ms ease; }

/* Indicador de carga global */
#htmx-indicator {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ahora);
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 999;
}
.htmx-request #htmx-indicator { opacity: 1; }

/* ── View Switcher (header) ──────────────────────────────────── */
.app-header__views {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 2px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.view-btn:hover { background: var(--surface); color: var(--text-2); }
.view-btn--active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.view-btn__icon { font-size: 16px; line-height: 1; }

/* ── Toggle Tema ─────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  transition: background var(--t-fast), color var(--t-fast);
  margin-left: var(--sp-2);
}
.theme-toggle:hover { background: var(--surface); color: var(--text-2); }

/* ── Vista Pizarra (Kanban) ──────────────────────────────────── */
.board-view {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-3);
  min-height: calc(100vh - 72px);
  align-items: start;
}

.board-col {
  background: var(--surface-2);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.board-col__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.board-col__icon { font-size: 14px; }
.board-col--horizonte .board-col__icon { color: var(--horizonte); }
.board-col--ahora .board-col__icon { color: var(--ahora); }
.board-col--buffer .board-col__icon { color: var(--buffer); }
.board-col--done .board-col__icon { color: var(--success); }

.board-col__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  flex: 1;
}

.board-col__body {
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  flex: 1;
}

.board-col__footer {
  padding: var(--sp-2);
  border-top: 1px solid var(--border);
}

/* Board card — post-it style */
.board-card {
  background: var(--postit-default);
  border: none;
  border-radius: 2px;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  box-shadow: 2px 3px 6px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.08);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.board-card:hover {
  box-shadow: 3px 5px 12px rgba(0,0,0,0.16);
  transform: translateY(-1px);
}

.board-card--slot { border-left: 3px solid var(--ahora); }
.board-card--blocked { border-left: 3px solid var(--warning); background: #FFF3CD !important; }
.board-card--done { opacity: 0.5; }

.board-card__slot-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-1);
}
.board-card__slot-label--critica    { color: var(--slot-critica); }
.board-card__slot-label--importante { color: var(--slot-importante); }
.board-card__slot-label--corta      { color: var(--slot-corta); }

.board-card__top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.board-card__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.board-card__desc {
  font-size: 11px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-card__meta {
  font-size: 10px;
  color: var(--muted);
}

.board-card__block {
  font-size: 11px;
  color: var(--warning);
  font-style: italic;
}

.board-card__actions {
  display: flex;
  gap: var(--sp-1);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.board-card:hover .board-card__actions { opacity: 1; }

/* Board card color por categoría */
.board-card[data-category="producto"]       { background: var(--postit-producto); }
.board-card[data-category="cliente"]        { background: var(--postit-cliente); }
.board-card[data-category="operacion"]      { background: var(--postit-operacion); }
.board-card[data-category="administracion"] { background: var(--postit-administracion); }
.board-card[data-category="idea"]           { background: var(--postit-idea); }
.board-card[data-category="espera"]         { background: var(--postit-espera); }

@media (max-width: 1200px) {
  .board-view { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .board-view { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .board-view { grid-template-columns: 1fr; }
}

/* ── Vista Tabla ─────────────────────────────────────────────── */
.table-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-view__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.table-view__title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.task-table__th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.task-table__th--cat { width: 90px; }
.task-table__th--actions { width: 100px; text-align: center; }

.task-table__row {
  transition: background var(--t-fast);
}
.task-table__row:hover { background: var(--surface-2); }
.task-table__row--done { opacity: 0.5; }

.task-table__td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.task-table__td--actions { text-align: center; white-space: nowrap; }

.task-table__title-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.task-table__desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-table__cat {
  font-size: 11px;
  color: var(--text-2);
}

.task-table__status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.task-table__status--horizonte { background: var(--horizonte-l); color: var(--horizonte); }
.task-table__status--ahora     { background: var(--ahora-l); color: var(--ahora); }
.task-table__status--buffer    { background: var(--buffer-l); color: var(--buffer); }

.task-table__priority {
  font-size: 11px;
  color: var(--text-2);
  text-transform: capitalize;
}

.task-table__origin {
  font-size: 11px;
  color: var(--muted);
}

.task-table__date {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Drag & Drop ─────────────────────────────────────────────── */

/* Tarjeta arrastrada */
.task-card[draggable="true"] {
  cursor: grab;
}
.task-card[draggable="true"]:active { cursor: grabbing; }

.task-card--dragging {
  opacity: 0.4;
}

/* Drop zones: resaltado cuando hay un drag activo */
.dragging-active .drop-zone {
  outline: 2px dashed var(--border-2);
  outline-offset: -2px;
  border-radius: var(--r-md);
  transition: outline-color var(--t-fast), background var(--t-fast);
}

/* Drop zone cuando el cursor está encima */
.drop-zone--over {
  outline-color: var(--horizonte) !important;
  background: var(--horizonte-l) !important;
}

/* Slots de Ahora con feedback diferenciado */
.slot.drop-zone--over[data-drop-slot="critica"]    { outline-color: var(--slot-critica) !important; background: #FEE2E2 !important; }
.slot.drop-zone--over[data-drop-slot="importante"] { outline-color: var(--slot-importante) !important; background: var(--warning-l) !important; }
.slot.drop-zone--over[data-drop-slot="corta"]      { outline-color: var(--slot-corta) !important; background: #DBEAFE !important; }
