/* TaskFlow MVP — Sistema de diseño completo
   Tipografía: Bricolage Grotesque (titulares) + Geist (cuerpo)
   Paleta cream + teal con dark mode */

/* ── Variables (light) ─────────────────────────────────────────────────── */
:root {
  --bg:        #faf7f2;
  --surface:   #ffffff;
  --raised:    #f5f1e8;
  --border:    #e8e3d9;
  --t1:        #1c2025;
  --t2:        #3a3f47;
  --t3:        #5b6066;
  --t4:        #8b9098;
  --t5:        #bfc3c9;
  --accent:    #0d4f4a;
  --accent-h:  #0a3f3b;
  --accent-l:  #e6f0ef;
  --amber-bg:  #fdf6e7;
  --amber:     #b07908;
  --rust-bg:   #fbeae4;
  --rust:      #b04a26;
  --mint-bg:   #e6f3ec;
  --mint:      #1f7a48;
  --violet-bg: #f0e6f5;
  --violet:    #5b3a7a;
  --ocean-bg:  #e6edf5;
  --ocean:     #1a4b7a;
  --sb-width:  240px;
  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --bg:        #0f1117;
  --surface:   #1a1d24;
  --raised:    #222530;
  --border:    #2e3240;
  --t1:        #e8e9ec;
  --t2:        #b4b8c2;
  --t3:        #7b8194;
  --t4:        #555b6e;
  --t5:        #3a3e4e;
  --accent:    #2d9e96;
  --accent-h:  #3bbcb3;
  --accent-l:  #0d2f2e;
  --amber-bg:  #2a1e05;
  --amber:     #e8a820;
  --rust-bg:   #2a0e05;
  --rust:      #e86840;
  --mint-bg:   #052212;
  --mint:      #3ab86e;
  --violet-bg: #1a0e28;
  --violet:    #a070d8;
  --ocean-bg:  #0a1828;
  --ocean:     #4a90d8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--t1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

/* ═══════════════════════════════════════════════════════════════════════ */
/* TOPBAR — nav superior horizontal con dropdown de usuario                */
/* Paleta coherente con el login (gradient teal)                           */
/* ═══════════════════════════════════════════════════════════════════════ */
@keyframes topbar-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes live-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.7); }
  50%      { box-shadow: 0 0 0 6px rgba(110, 231, 183, 0); }
}
@keyframes notif-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@keyframes shimmer-bg {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.topbar {
  background: linear-gradient(135deg, #0d6b5e 0%, #114c44 50%, #0a3530 100%);
  color: #fff;
  height: 48px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  /* Respetar safe-area del notch/dynamic island en iPhone PWA */
  padding: 0 18px;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left:  calc(18px + env(safe-area-inset-left, 0px));
  padding-right: calc(18px + env(safe-area-inset-right, 0px));
  height: calc(48px + env(safe-area-inset-top, 0px));
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 4px 14px rgba(13, 107, 94, 0.12);
  animation: topbar-fade-in .3s ease-out;
}
/* Línea de acento bajo el topbar — sensación "sistema vivo" */
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(110, 231, 183, 0.5) 30%, rgba(217, 119, 87, 0.5) 70%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer-bg 6s ease-in-out infinite;
  pointer-events: none;
}
.topbar-l { display: flex; align-items: center; gap: 24px; height: 100%; }
.topbar-r { display: flex; align-items: center; gap: 12px; height: 100%; }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  position: relative;
}
.topbar-brand:hover { color: #fff; }
.topbar-brand svg { transition: transform .3s ease; }
.topbar-brand:hover svg { transform: rotate(-8deg) scale(1.08); }
/* Dot pulsante "sistema en vivo" al lado del logo */
.topbar-brand::after {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #6ee7b7;
  margin-left: 4px;
  animation: live-dot-pulse 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

.topbar-nav { display: flex; gap: 0; height: 100%; align-items: stretch; }
.topbar-nav-item {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
  gap: 6px;
  position: relative;
}
.topbar-nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}
.topbar-nav-item.active {
  color: #fff;
  font-weight: 500;
  border-bottom-color: #6ee7b7;
  background: rgba(110, 231, 183, 0.08);
}
.topbar-nav-item.active::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 60%;
  height: 2px;
  background: #6ee7b7;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(110, 231, 183, 0.7);
  border-radius: 1px;
}
.topbar-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 7px;
  font-weight: 600;
  color: white;
  background: var(--mid, #888);
  line-height: 14px;
  min-width: 16px;
  text-align: center;
}
.topbar-badge.danger { background: var(--rust, #d85a30); }
.topbar-badge.warn { background: var(--amber, #ba7517); }

/* ─── Búsqueda global en topbar ─── */
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: white;
  padding: 6px 10px 6px 30px;
  font-size: 12px;
  width: 220px;
  font-family: inherit;
  transition: background .2s, border-color .2s, width .25s;
}
.topbar-search input::placeholder { color: rgba(255,255,255,0.55); }
.topbar-search input:focus {
  outline: none;
  background: rgba(255,255,255,0.18);
  border-color: rgba(110, 231, 183, 0.5);
  width: 280px;
}
.topbar-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.55);
  pointer-events: none;
}
.topbar-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-height: 460px;
  overflow-y: auto;
  display: none;
  z-index: 200;
  min-width: 380px;
}
.topbar-search.open .topbar-search-results { display: block; }
.tsr-group {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--t4);
  font-weight: 600;
  letter-spacing: .05em;
  padding: 8px 12px 4px;
  border-bottom: 0.5px solid var(--border-l);
}
.tsr-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 0.5px solid var(--border-l);
}
.tsr-item:last-child { border-bottom: none; }
.tsr-item:hover { background: var(--raised); }
.tsr-icon { font-size: 14px; flex-shrink: 0; padding-top: 1px; }
.tsr-body { flex: 1; min-width: 0; }
.tsr-title {
  font-size: 13px;
  color: var(--t1);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tsr-sub {
  font-size: 11px;
  color: var(--t4);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tsr-empty {
  padding: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--t4);
}
.tsr-loading {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--t4);
}

.topbar-area-form { display: flex; align-items: center; margin: 0; }
.topbar-area-select {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.topbar-area-select:hover { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.28); }
.topbar-area-select option { color: var(--t1); background: var(--surface); }

/* ─── Animaciones globales sutiles "sistema vivo" ─── */
@keyframes card-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dash-content > * { animation: card-fade-up .35s ease-out backwards; }
.dash-content > *:nth-child(1) { animation-delay: 0s; }
.dash-content > *:nth-child(2) { animation-delay: 0.04s; }
.dash-content > *:nth-child(3) { animation-delay: 0.08s; }
.dash-content > *:nth-child(4) { animation-delay: 0.12s; }
.dash-content > *:nth-child(5) { animation-delay: 0.16s; }

/* Banner de atrasadas: respiración leve para llamar la atención sin estorbar */
.overdue-banner {
  position: relative;
}
.overdue-banner::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--rust);
  animation: breathe 2.4s ease-in-out infinite;
}

/* Alertas críticas (panel ejecutivo): borde izquierdo respira */
.exec-stuck-row.exec-reason-danger {
  position: relative;
}
.exec-stuck-row.exec-reason-danger::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--rust);
  animation: breathe 2.4s ease-in-out infinite;
}

/* Badge pulsante en contadores rojos (atrasadas/críticas) */
.dash-sidebar-count.danger,
.dash-tab-badge.danger {
  animation: notif-pulse 2s ease-in-out infinite;
}

/* Sidebar contextual: indicador activo con barra animada */
.dash-sidebar-link.active {
  position: relative;
}
.dash-sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, #0d6b5e, #6ee7b7);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(110, 231, 183, 0.4);
}

/* Hover smooth en cards de tareas */
.task-card,
.cycle-task-row,
.exec-stuck-row,
.exec-health-card,
.pool-task-card,
.approval-card,
.campaign-card {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.task-card:hover,
.exec-stuck-row:hover,
.exec-health-card:hover,
.approval-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 107, 94, 0.08);
}

/* Botones con feedback al click */
.btn { transition: transform .12s ease, background .15s ease, box-shadow .15s ease; }
.btn:active { transform: translateY(1px); }

.topbar-icon-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 6px;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
}
.topbar-icon-btn:hover { color: white; background: rgba(255,255,255,0.08); }
.topbar-icon-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--rust, #d85a30);
  color: white;
  font-size: 9px;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 7px;
  line-height: 13px;
  min-width: 14px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(13, 107, 94, 0.9);
  animation: notif-pulse 1.8s ease-in-out infinite;
  transform-origin: center;
}

.topbar-avatar-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}
.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d97757 0%, #c0653f 100%);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
  transition: transform .2s ease, box-shadow .2s ease;
}
.topbar-avatar-btn:hover .topbar-avatar {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

.topbar-menu { position: relative; }
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: none;
  z-index: 200;
}
.topbar-dropdown-wide { min-width: 320px; }
.topbar-menu.open .topbar-dropdown { display: block; }

.topbar-dropdown-head {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border-l);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar-dropdown-mini {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  text-transform: none;
  font-weight: 500;
}
.topbar-dropdown-empty {
  padding: 16px;
  text-align: center;
  color: var(--t4);
  font-size: 12px;
}
.topbar-dropdown-userhead {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border-l);
}
.topbar-dropdown-name { font-weight: 500; font-size: 13px; color: var(--t1); }
.topbar-dropdown-email { font-size: 11px; color: var(--t4); margin-top: 1px; }
.topbar-dropdown-role { font-size: 10px; color: var(--accent); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.topbar-dropdown-sep { height: 1px; background: var(--border-l); margin: 4px 0; }
.topbar-dropdown-group {
  padding: 6px 14px 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.topbar-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--t2);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.topbar-dropdown-item:hover { background: var(--raised); color: var(--t1); }
.topbar-dropdown-btn { font: inherit; }
.topbar-dropdown-danger { color: var(--rust); }
.topbar-dropdown-foot {
  display: block;
  padding: 8px 14px;
  text-align: center;
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  border-top: 1px solid var(--border-l);
}
.topbar-notif {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.topbar-notif.unread { background: var(--ocean-bg); }
.topbar-notif-msg { font-size: 12.5px; line-height: 1.35; color: var(--t1); }
.topbar-notif-time { font-size: 10px; color: var(--t4); }

/* sidebar viejo — completamente oculto en el nuevo layout */
.sidebar {
  display: none !important;
}
.sidebar-old-original-styles-below-ignored {
  width: var(--sb-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sb-top { padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
.sb-logo {
  display: flex; align-items: center; gap: 9px;
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-size: 17px; font-weight: 600; color: var(--accent);
  letter-spacing: -.02em; text-decoration: none;
}
.sb-logo:hover { text-decoration: none; }
.sb-role {
  font-size: 11px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--t4); font-weight: 600; margin-top: 5px;
}
.sb-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: var(--t3); font-size: 13px; text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-item:hover { background: var(--raised); color: var(--t1); text-decoration: none; }
.nav-item.active { background: var(--accent-l); color: var(--accent); font-weight: 500; }
.nav-item svg { flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 999px;
}
.nav-badge.danger { background: var(--rust); }

.sb-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.sb-user {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; margin-bottom: 8px;
}
.sb-user:hover .sb-user-name { color: var(--accent); }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-l); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.sb-user-info { min-width: 0; flex: 1; }
.sb-user-name {
  font-size: 13px; font-weight: 500; color: var(--t1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-email {
  font-size: 11px; color: var(--t4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent; border: none;
  color: var(--t3); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--raised); color: var(--t1); }

.main-content {
  flex: 1; margin-left: 0;  /* topbar arriba, no sidebar lateral */
  min-height: calc(100vh - 48px); display: flex; flex-direction: column;
}
.page-header { display: flex; align-items: center; gap: 12px; padding: 22px 28px 0; flex-wrap: wrap; }
.page-title {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
  font-weight: 600; letter-spacing: -.02em;
  color: var(--t1); flex: 1; min-width: 0;
}
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-body { padding: 22px 28px 40px; }

/* ── Flash ──────────────────────────────────────────────────────────────── */
.flash {
  margin: 14px 28px 0;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
}
.flash-success { background: var(--mint-bg);  color: var(--mint);  border: 1px solid var(--mint); }
.flash-error   { background: var(--rust-bg);  color: var(--rust);  border: 1px solid var(--rust); }
.flash-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber); }
.flash-info    { background: var(--accent-l); color: var(--accent); border: 1px solid var(--accent); }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; font-size: 14px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--raised);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-size: 12px; font-weight: 600; color: var(--t3);
  text-transform: uppercase; letter-spacing: .12em;
}
.card-body { padding: 16px 18px; }

/* ── Métricas ───────────────────────────────────────────────────────────── */
.metric-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.metric-card {
  background: var(--raised); border-radius: var(--radius);
  padding: 14px 16px;
}
.metric-label { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--t4); font-weight: 600; margin-bottom: 6px; }
.metric-value { font-size: 28px; font-weight: 600; color: var(--t1); line-height: 1; font-family: 'Bricolage Grotesque', serif; }
.metric-card.danger  .metric-value { color: var(--rust); }
.metric-card.warning .metric-value { color: var(--amber); }
.metric-card.success .metric-value { color: var(--mint); }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 14px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--t4); font-weight: 600; text-align: left;
  background: var(--raised); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--t2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--raised); }
tbody tr.clickable { cursor: pointer; }
.td-primary { font-weight: 500; color: var(--t1) !important; }
.td-muted   { color: var(--t4) !important; font-size: 12px; }

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none; white-space: nowrap;
  font-family: inherit;
}
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--raised); border-color: var(--border); color: var(--t2); }
.btn-secondary:hover { border-color: var(--t4); color: var(--t1); text-decoration: none; }
.btn-danger    { background: var(--rust-bg); border-color: var(--rust); color: var(--rust); }
.btn-danger:hover { background: var(--rust); color: #fff; text-decoration: none; }
.btn-ghost     { background: transparent; border-color: transparent; color: var(--t3); }
.btn-ghost:hover { background: var(--raised); color: var(--t1); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn svg { flex-shrink: 0; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
label {
  display: block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--t4); margin-bottom: 5px;
}
.input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--t1);
  font-size: 13px; font-family: inherit;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 80px; }
select.input { cursor: pointer; }
.input:disabled { background: var(--raised); color: var(--t4); cursor: not-allowed; }
.form-hint  { font-size: 11px; color: var(--t4);  margin-top: 4px; }
.form-error { font-size: 11px; color: var(--rust); margin-top: 4px; }
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--t2);
  text-transform: none; letter-spacing: 0; font-weight: 400;
  cursor: pointer; margin-bottom: 0;
}
.checkbox-label input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent); cursor: pointer;
}

/* ── Pills ──────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.pill-pendiente   { background: var(--amber-bg);  color: var(--amber); }
.pill-en_progreso { background: var(--ocean-bg);  color: var(--ocean); }
.pill-bloqueada   { background: var(--rust-bg);   color: var(--rust);  }
.pill-completada  { background: var(--mint-bg);   color: var(--mint);  }
.pill-rechazada   { background: var(--raised);    color: var(--t4);    }
.pill-propuesta   { background: var(--violet-bg); color: var(--violet);}
.pill-saltada     { background: var(--amber-bg);  color: var(--amber); border: 1px solid var(--rust); }
.pill-urgente { background: var(--rust);   color: #fff; }
.pill-alta    { background: var(--amber);  color: #fff; }
.pill-media   { background: var(--raised); color: var(--t3); }
.pill-baja    { background: var(--raised); color: var(--t4); }
.pill-warn    { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--rust); }
.pill-active  { background: var(--ocean-bg); color: var(--ocean); }
.pill-done    { background: var(--mint-bg);  color: var(--mint);  }

/* ── Progress ───────────────────────────────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.progress-bar.warning { background: var(--amber); }
.progress-bar.success { background: var(--mint); }
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-pct { font-size: 11px; color: var(--t4); min-width: 36px; text-align: right; }

/* ── Alert banner ───────────────────────────────────────────────────────── */
.alert-banner {
  background: var(--rust-bg); border: 1px solid var(--rust);
  border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 16px;
}
.alert-banner-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; color: var(--rust);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.alert-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 6px 0;
  font-size: 12px; color: var(--t2);
}
.alert-row + .alert-row { border-top: 1px solid rgba(0,0,0,.06); }
.alert-actions { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }

/* ── Section title ──────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title  {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; color: var(--t4);
}

/* ── Workflow steps ─────────────────────────────────────────────────────── */
.step-list { padding: 0 16px; }
.step-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.step-num.done    { background: var(--mint-bg);   color: var(--mint); }
.step-num.active  { background: var(--accent);    color: #fff; }
.step-num.blocked { background: var(--raised);    color: var(--t4); border: 1px dashed var(--border); }
.step-num.skipped { background: var(--amber-bg);  color: var(--amber); }
.step-num.critical-blocked { background: var(--rust-bg); color: var(--rust); border: 1px solid var(--rust); }
.step-body { flex: 1; padding-top: 2px; min-width: 0; }
.step-title { font-size: 13px; font-weight: 500; color: var(--t1); }
.step-meta  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 11px; color: var(--t4); }
.step-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ── Comments ───────────────────────────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item { display: flex; gap: 10px; }
.comment-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-l); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.comment-bubble { flex: 1; background: var(--raised); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 10px 14px; min-width: 0; }
.comment-meta   { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.comment-author { font-size: 12px; font-weight: 600; color: var(--t1); }
.comment-time   { font-size: 11px; color: var(--t4); }
.comment-body   { font-size: 13px; color: var(--t2); line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }

/* ── Plantillas (cards grid) ─────────────────────────────────────────────── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.template-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s;
}
.template-card:hover { border-color: var(--accent); }
.template-card-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.template-name  { font-size: 14px; font-weight: 600; color: var(--t1); }
.template-desc  { font-size: 12px; color: var(--t4); line-height: 1.4; flex: 1; }
.template-stats { display: flex; gap: 10px; font-size: 11px; color: var(--t4); flex-wrap: wrap; }
.template-foot  { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.recur-badge { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 999px; }
.recur-monthly   { background: var(--ocean-bg);  color: var(--ocean); }
.recur-quarterly { background: var(--violet-bg); color: var(--violet); }
.recur-yearly    { background: var(--amber-bg);  color: var(--amber); }

/* ── Wizard ─────────────────────────────────────────────────────────────── */
.wizard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.wizard-head { padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--raised); }
.wizard-title { font-size: 15px; font-weight: 600; color: var(--t1); margin-bottom: 10px; }
.wizard-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wizard-step  { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--t4); }
.wizard-step.active { color: var(--accent); font-weight: 500; }
.wizard-step.done   { color: var(--mint); }
.step-circle {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border); color: var(--t3);
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.wizard-step.active .step-circle { background: var(--accent); color: #fff; }
.wizard-step.done   .step-circle { background: var(--mint);   color: #fff; }
.wizard-sep { color: var(--t5); font-size: 12px; }
.wizard-body { padding: 20px; }

/* ── Preview steps (en lanzamiento) ──────────────────────────────────────── */
.preview-step { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.preview-step:last-child { border-bottom: none; }
.ps-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ps-body { flex: 1; min-width: 0; }
.ps-title { font-size: 13px; font-weight: 500; color: var(--t1); }
.ps-meta  { font-size: 11px; color: var(--t4); margin-top: 2px; }
.ps-assign { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ps-av {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-l); color: var(--accent);
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.ps-dur { font-size: 11px; color: var(--t4); min-width: 50px; text-align: right; flex-shrink: 0; }

/* ── Gantt strip ────────────────────────────────────────────────────────── */
.gantt-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.gantt-row:last-child { border-bottom: none; }
.gantt-name {
  width: 160px; flex-shrink: 0;
  font-size: 12px; font-weight: 500; color: var(--t1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gantt-bar-wrap { flex: 1; height: 22px; background: var(--raised); border-radius: 4px; overflow: hidden; }
.gantt-bar {
  height: 100%; border-radius: 4px;
  display: flex; align-items: center; padding: 0 8px;
  font-size: 10px; font-weight: 600; color: #fff;
}
.gantt-pct { font-size: 11px; color: var(--t4); min-width: 36px; text-align: right; flex-shrink: 0; }

/* ── Quick-launch strip ─────────────────────────────────────────────────── */
.quick-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 20px; }
.quick-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; transition: border-color .15s;
  text-decoration: none; color: inherit;
  display: block;
}
.quick-card:hover { border-color: var(--accent); text-decoration: none; }
.quick-card-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 9px; font-size: 16px;
}
.quick-card-name { font-size: 12px; font-weight: 600; color: var(--t1); margin-bottom: 2px; }
.quick-card-sub  { font-size: 11px; color: var(--t4); }
.quick-card-badge { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 4px; margin-top: 7px; display: inline-block; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px; font-size: 13px; color: var(--t4);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  text-decoration: none; background: none; border-left: none; border-right: none; border-top: none;
  font-family: inherit;
}
.tab:hover { color: var(--t1); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ── History timeline ───────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 0; }
.history-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.history-icon {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px; font-size: 11px;
}
.history-icon.status  { background: var(--ocean-bg);  color: var(--ocean); }
.history-icon.comment { background: var(--accent-l);  color: var(--accent); }
.history-icon.skip    { background: var(--amber-bg);  color: var(--amber); }
.history-body { flex: 1; min-width: 0; }
.history-text { font-size: 12px; color: var(--t2); }
.history-time { font-size: 11px; color: var(--t4); margin-top: 2px; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 50px 20px; }
.empty-state svg { color: var(--t5); margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; color: var(--t2); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; color: var(--t4); }

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px; width: 100%; max-width: 400px;
}
.login-logo {
  font-family: 'Bricolage Grotesque', serif;
  font-size: 22px; font-weight: 600; color: var(--accent);
  margin-bottom: 6px;
}
.login-subtitle { font-size: 13px; color: var(--t4); margin-bottom: 28px; }

/* ── Notifications list ─────────────────────────────────────────────────── */
.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.notif-item.unread { background: var(--accent-l); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-dot.unread { background: var(--accent); }
.notif-dot.read   { background: var(--border); }
.notif-text { flex: 1; }
.notif-msg  { font-size: 13px; color: var(--t1); }
.notif-time { font-size: 11px; color: var(--t4); margin-top: 2px; }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.text-muted   { color: var(--t4); }
.text-danger  { color: var(--rust); }
.text-success { color: var(--mint); }
.text-warning { color: var(--amber); }
.text-accent  { color: var(--accent); }
.fw-500 { font-weight: 500; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 20px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 20px; }
.ml-auto { margin-left: auto; }
.w-100 { width: 100%; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.d-flex { display: flex; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .campaign-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .detail-grid, .two-col { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sb-width: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body, .page-header { padding-left: 16px; padding-right: 16px; }
}

/* ── Animations ─────────────────────────────────────────────────────────── */
.slide-up { animation: slideUp .38s ease both; }
.slide-up-1 { animation-delay: 50ms; }
.slide-up-2 { animation-delay: 100ms; }
.slide-up-3 { animation-delay: 150ms; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } }

/* ── v4: Bloques, checklists, divisiones ─────────────────────────────── */
.block-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.block-card.recurrent { border-left-color: var(--mint); }
.block-card.informative { border-left-color: var(--t4); }
.block-card.cierre { border-left-color: var(--amber); }
.block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.block-title { font-size: 15px; font-weight: 600; color: var(--t1); }
.block-meta { font-size: 12px; color: var(--t4); margin-top: 3px; }

/* Checklist items */
.checklist-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.done { color: var(--t4); text-decoration: line-through; }
.checklist-checkbox {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1.5px solid var(--t4); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
  background: transparent;
}
.checklist-checkbox.checked { background: var(--mint); border-color: var(--mint); color: white; }
.checklist-checkbox:hover { border-color: var(--accent); }
.checklist-label { flex: 1; min-width: 0; }
.checklist-meta { font-size: 11px; color: var(--t4); }

.checklist-progress {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 0 12px;
}
.checklist-progress .progress { flex: 1; height: 7px; }

/* Trenecitos de avances */
.advance-train {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  margin-top: 6px;
}
.advance-pill {
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 600;
  white-space: nowrap;
}
.advance-pill.done { background: var(--mint-bg); color: var(--mint); }
.advance-pill.active { background: var(--ocean-bg); color: var(--ocean); }
.advance-pill.late { background: var(--rust-bg); color: var(--rust); }
.advance-pill.upcoming { background: var(--raised); color: var(--t4); }

/* Wholesaler row */
.ws-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.ws-row:last-child { border-bottom: none; }
.ws-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ws-name { font-size: 13px; font-weight: 600; color: var(--t1); }
.ws-meta { font-size: 12px; color: var(--t4); }

/* Tabs admin */
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.admin-tab {
  padding: 9px 16px; font-size: 13px; color: var(--t4);
  cursor: pointer; border-bottom: 2px solid transparent;
  text-decoration: none; background: none;
  border-left: none; border-right: none; border-top: none;
  font-family: inherit;
}
.admin-tab:hover { color: var(--t1); text-decoration: none; }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* Incident card */
.incident-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.incident-row:last-child { border-bottom: none; }
.incident-row.open { background: var(--amber-bg); }
.incident-tag {
  display: inline-block;
  font-size: 10px; font-weight: 500;
  padding: 1px 7px; border-radius: 4px;
  background: var(--violet-bg); color: var(--violet);
}

/* Division/wholesaler structure builder en wizard */
.struct-line {
  background: var(--accent-l);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.struct-line-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.struct-ws {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 6px;
}
.struct-cedis-row {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-top: 6px;
}
.cedis-chip {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  display: inline-flex; align-items: center; gap: 4px;
}
.cedis-chip-x {
  cursor: pointer; color: var(--t4);
  background: none; border: none;
  font-size: 13px; padding: 0;
}
.cedis-chip-x:hover { color: var(--rust); }

/* Eficiencia / dashboard de reportes */
.eff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.eff-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.eff-rate-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.eff-rate-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .3s;
}
.eff-rate-fill.good { background: var(--mint); }
.eff-rate-fill.warn { background: var(--amber); }
.eff-rate-fill.bad  { background: var(--rust); }

/* ── Dashboard v4.1 ─────────────────────────────────────────────────────── */

/* Banner de aprobación pendiente */
.approval-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--violet-bg);
  border: 1px solid var(--violet);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--violet);
}

.approval-pending-banner,
.approval-rejected-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.approval-pending-banner {
  background: var(--violet-bg);
  border: 1px solid var(--violet);
}
.approval-rejected-banner {
  background: var(--rust-bg);
  border: 1px solid var(--rust);
}
.apb-icon {
  font-size: 22px;
  line-height: 1;
}
.apb-body { flex: 1; }
.apb-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 3px;
}
.approval-pending-banner .apb-title { color: var(--violet); }
.approval-rejected-banner .apb-title { color: var(--rust); }
.apb-text {
  font-size: 12px;
  color: var(--t2);
  line-height: 1.5;
}
.apb-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Pill "Sin flujo" en tarea */
.task-extra-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: var(--violet-bg);
  color: var(--violet);
  border-radius: 999px;
}

/* Section header con switch */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  margin-top: 4px;
}
.section-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.scope-switch {
  display: inline-flex;
  background: var(--raised);
  border-radius: 7px;
  padding: 2px;
  border: 1px solid var(--border);
}
.scope-switch a {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 5px;
  color: var(--t4);
  text-decoration: none;
  transition: all .15s;
}
.scope-switch a.active {
  background: var(--surface);
  color: var(--t1);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* DASHBOARD SHELL — tabs arriba + sidebar contextual                      */
/* ═══════════════════════════════════════════════════════════════════════ */
.dash-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 16px;
  overflow-x: auto;
}
.dash-tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--t3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .12s;
}
.dash-tab:hover { color: var(--t1); }
.dash-tab.active {
  color: var(--accent);
  font-weight: 500;
  border-bottom-color: var(--accent);
}
.dash-tab-badge {
  background: var(--accent);
  color: white;
  font-size: 9px;
  padding: 0 6px;
  border-radius: 10px;
  font-weight: 500;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
  display: inline-block;
}
.dash-tab-badge.danger { background: var(--rust); }
.dash-tab-badge.warn { background: var(--amber); }
.dash-tab-badge.neutral { background: var(--mid); }

.dash-shell {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .dash-shell { grid-template-columns: 1fr; }
}

.dash-sidebar {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  position: sticky;
  top: 70px;
}
.dash-sidebar-group {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t4);
  font-weight: 600;
  padding: 8px 8px 4px;
  border-top: 1px solid var(--border-l);
  margin-top: 6px;
}
.dash-sidebar-group:first-child { border-top: none; margin-top: 0; padding-top: 2px; }
.dash-sidebar-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--t2);
  text-decoration: none;
  border-radius: 5px;
  margin-bottom: 1px;
  cursor: pointer;
}
.dash-sidebar-link:hover { background: var(--surface); color: var(--t1); }
.dash-sidebar-link.active {
  background: var(--ocean-bg);
  color: var(--ocean);
  font-weight: 500;
}
.dash-sidebar-count {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--mid);
  color: white;
  font-weight: 500;
  min-width: 18px;
  text-align: center;
}
.dash-sidebar-count.danger { background: var(--rust); }
.dash-sidebar-count.warn { background: var(--amber); }
.dash-sidebar-count.zero {
  background: transparent;
  color: var(--t4);
}

.dash-content {
  min-width: 0;
}

/* ─── Vista Calendario ─── */
.cal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.cal-toolbar-nav { display: flex; gap: 6px; }
.cal-toolbar-title strong {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-size: 18px;
  color: var(--t1);
  font-weight: 600;
}
.cal-toolbar-meta { font-size: 11px; color: var(--t4); margin-left: 8px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.cal-dow {
  background: var(--raised);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
}
.cal-dow-weekend { color: var(--t4); }

.cal-day {
  background: var(--surface);
  min-height: 110px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  position: relative;
}
.cal-day-empty { background: var(--raised); }
.cal-day-past { opacity: 0.78; }
.cal-day-weekend { background: var(--raised); }
.cal-day-today {
  background: var(--ocean-bg);
  outline: 2px solid var(--ocean);
  outline-offset: -2px;
  z-index: 1;
}
.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--t3);
  margin-bottom: 2px;
}
.cal-day-today .cal-day-num {
  color: var(--ocean);
  font-weight: 700;
}

.cal-item {
  display: block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  color: var(--t2);
  background: var(--border-l);
}
.cal-item:hover { filter: brightness(1.06); }
.cal-item-camp-start {
  background: linear-gradient(90deg, #0d6b5e, #114c44);
  color: #fff;
  font-weight: 500;
}
.cal-item-camp-end {
  background: linear-gradient(90deg, #d97757, #c0653f);
  color: #fff;
  font-weight: 500;
}
.cal-task-pending { background: #f1efe8; color: #444; }
.cal-task-doing   { background: #B5D4F4; color: #0C447C; font-weight: 500; }
.cal-task-done    { background: #9FE1CB; color: #085041; opacity: .75; text-decoration: line-through; }
.cal-task-late    { background: #F7C1C1; color: #501313; font-weight: 500; }
.cal-task-skip    { background: #FAEEDA; color: #854F0B; font-style: italic; }
.cal-task-wait    { background: #FAC775; color: #633806; }

.cal-more {
  font-size: 10px;
  color: var(--t4);
  font-style: italic;
  padding: 1px 4px;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--raised);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--t3);
}
.cal-leg-i { display: flex; align-items: center; gap: 5px; }
.cal-leg-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

@media (max-width: 700px) {
  /* Calendario en mobile: scroll horizontal manteniendo las 7 columnas legibles */
  .cal-grid { min-width: 560px; }
  .cal-day { min-height: 80px; padding: 4px; }
  .cal-day-num { font-size: 11px; }
  .cal-dow { padding: 6px 4px; font-size: 10px; }
  .cal-item { font-size: 10px; padding: 2px 5px; }
  /* Toolbar arriba del calendario */
  .cal-toolbar { flex-wrap: wrap; gap: 8px; }
  .cal-toolbar-title strong { font-size: 14px; }
  .cal-toolbar-meta { display: block; margin-left: 0; }
}

/* ─── Onboarding tour ─── */
/* ──────────────────────────────────────────────────────────────────────────
   ONBOARDING TOUR — Spotlight con 4 paneles que recortan el elemento
   destacado, dejándolo nítido mientras el resto queda oscurecido + blur.
   ────────────────────────────────────────────────────────────────────────── */
.onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none; /* el contenedor no captura; lo hacen los hijos */
  transition: opacity .4s;
  animation: onb-overlay-in .45s ease-out;
}
@keyframes onb-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Cada uno de los 4 paneles que rodean al spotlight.
   Bloquean clicks y aplican el oscurecimiento + blur. */
.onboard-mask {
  position: fixed;
  background: rgba(6, 22, 21, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;             /* bloquea clicks */
  transition: top .42s cubic-bezier(.6,.0,.2,1),
              left .42s cubic-bezier(.6,.0,.2,1),
              right .42s cubic-bezier(.6,.0,.2,1),
              bottom .42s cubic-bezier(.6,.0,.2,1),
              width .42s cubic-bezier(.6,.0,.2,1),
              height .42s cubic-bezier(.6,.0,.2,1);
}

/* Marco decorativo alrededor del spotlight — anillo verde pulsante */
.onboard-spotlight-border {
  position: fixed;
  pointer-events: auto;             /* también bloquea clicks sobre el target */
  border-radius: 10px;
  border: 2px solid #34d399;
  box-shadow:
    0 0 0 4px rgba(52, 211, 153, 0.25),
    0 0 24px 6px rgba(110, 231, 183, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: top .42s cubic-bezier(.6,.0,.2,1),
              left .42s cubic-bezier(.6,.0,.2,1),
              width .42s cubic-bezier(.6,.0,.2,1),
              height .42s cubic-bezier(.6,.0,.2,1);
  animation: onb-spotlight-pulse 1.6s ease-in-out infinite;
}
@keyframes onb-spotlight-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 4px rgba(52, 211, 153, 0.25),
      0 0 24px 6px rgba(110, 231, 183, 0.55),
      inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(52, 211, 153, 0.35),
      0 0 38px 12px rgba(110, 231, 183, 0.75),
      inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  }
}

/* Wrap centrado del card */
.onboard-card-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;             /* deja pasar clicks fuera del card */
  z-index: 9999;
}

.onboard-card {
  background: #ffffff;
  color: #1c2025;
  border: 1px solid rgba(13, 79, 74, 0.15);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 26px 30px 22px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.50),
    0 12px 24px rgba(0, 0, 0, 0.30),
    0 0 0 1px rgba(110, 231, 183, 0.20);
  position: relative;
  pointer-events: auto;             /* el card SÍ recibe clicks */
  animation: onb-card-in .55s cubic-bezier(.34, 1.56, .64, 1) both;
  transform-origin: center bottom;
}
@keyframes onb-card-in {
  0%   { transform: scale(.7) translateY(40px); opacity: 0; }
  60%  { transform: scale(1.04) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.onb-card-out {
  animation: onb-card-out .35s ease-in both !important;
}
@keyframes onb-card-out {
  to { transform: scale(.9) translateY(20px); opacity: 0; }
}
/* Celebración al terminar el tour */
.onb-card-out-celebrate {
  animation: onb-card-celebrate .5s cubic-bezier(.34, 1.56, .64, 1) both !important;
}
@keyframes onb-card-celebrate {
  0%   { transform: scale(1) rotate(0); }
  30%  { transform: scale(1.12) rotate(-3deg); }
  60%  { transform: scale(1.08) rotate(2deg); }
  100% { transform: scale(.6) rotate(0) translateY(40px); opacity: 0; }
}

/* Animación de "entrada" del texto cuando cambia de paso */
.onb-text-in {
  animation: onb-text-fade .35s ease-out both;
}
@keyframes onb-text-fade {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.onboard-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: #8b9098;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
}
.onboard-close:hover { background: #f5f1e8; color: #1c2025; }
.onboard-step-indicator {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 11px;
  color: #8b9098;
}
.onboard-step-num {
  background: linear-gradient(135deg, #0d6b5e, #0a3530);
  color: #ffffff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}
.onboard-step-of {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  color: #8b9098;
}
.onboard-content h2 {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: #1c2025;
  margin: 0 0 8px;
}
.onboard-content p {
  font-size: 14px;
  color: #3a3f47;
  line-height: 1.55;
  margin: 0 0 24px;
}
.onboard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
/* Botón Saltar dentro del card debe ser legible sobre blanco siempre */
.onboard-card .btn-ghost {
  color: #5b6066;
  background: transparent;
}
.onboard-card .btn-ghost:hover {
  background: #f5f1e8;
  color: #1c2025;
}
.onboard-progress {
  height: 3px;
  background: #e8e3d9;
  border-radius: 2px;
  overflow: hidden;
}
.onboard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d6b5e, #6ee7b7);
  border-radius: 2px;
  transition: width .35s ease;
  width: 20%;
}
.onboard-highlight {
  /* Halo verde brillante alrededor del elemento original — no cambia su fondo
     ni su texto, solo lo "marca" con un anillo pulsante. */
  position: relative;
  z-index: 9999;
  border-radius: 8px !important;
  box-shadow:
    0 0 0 3px #34d399,
    0 0 0 8px rgba(52, 211, 153, 0.30),
    0 0 24px 6px rgba(110, 231, 183, 0.55) !important;
  animation: onboard-pulse 1.4s ease-in-out infinite;
}
@keyframes onboard-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px #34d399,
      0 0 0 8px rgba(52, 211, 153, 0.30),
      0 0 24px 6px rgba(110, 231, 183, 0.55);
  }
  50% {
    box-shadow:
      0 0 0 4px #34d399,
      0 0 0 12px rgba(52, 211, 153, 0.45),
      0 0 34px 10px rgba(110, 231, 183, 0.75);
  }
}

/* ─── Mención @usuario picker ─── */
.mention-picker {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  min-width: 260px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 9999;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 0.5px solid var(--border-l);
}
.mention-item:last-child { border-bottom: none; }
.mention-item:hover, .mention-item.selected {
  background: var(--ocean-bg);
}
.mention-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.mention-body { flex: 1; min-width: 0; }
.mention-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--t1);
}
.mention-sub {
  font-size: 10px;
  color: var(--t4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-empty {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--t4);
}

/* Estilo de las menciones renderizadas en los comentarios */
.comment-body, .activity-detail {
  /* Aplicado vía JS a body con @token */
}

/* ─── Audit log viewer ─── */
.audit-filters {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.audit-flbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--t4);
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}
.audit-list { display: flex; flex-direction: column; gap: 3px; }
.audit-row {
  display: grid;
  grid-template-columns: 130px 180px 140px 1fr 1.4fr;
  gap: 14px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  align-items: center;
}
.audit-c-mint { border-left-color: var(--mint); }
.audit-c-amber { border-left-color: var(--amber); }
.audit-c-rust { border-left-color: var(--rust); }
.audit-c-mid { border-left-color: var(--mid); }
.audit-time { font-family: var(--font-mono, monospace); font-size: 10.5px; color: var(--t4); }
.audit-action { color: var(--t1); font-weight: 500; }
.audit-actor strong { color: var(--t1); font-weight: 500; }
.audit-ent-type {
  font-size: 10px;
  background: var(--border-l);
  color: var(--t3);
  padding: 1px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 4px;
}
.audit-ent-name { color: var(--t2); }
.audit-detail { font-size: 11px; color: var(--t3); }
.audit-ip {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--t4);
  background: var(--raised);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
}
@media (max-width: 900px) {
  .audit-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ─── Panel de notas del equipo (tasks.php — antes en daily.php) ─── */
.daily-notes-panel {
  background: linear-gradient(135deg, #fdf6e7 0%, #faf7f2 100%);
  border: 1px solid #f0c987;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  overflow: hidden;
}
.daily-notes-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  color: #7a5305;
}
.daily-notes-summary::-webkit-details-marker { display: none; }
.daily-notes-summary::marker { content: ''; }
.daily-notes-summary strong { font-weight: 500; flex: 1; }
.daily-notes-icon { font-size: 16px; }
.daily-notes-flag {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 8px;
  background: #b07908;
  color: white;
  font-weight: 500;
}
.daily-notes-flag.empty { background: #c9c8c1; color: #5b6066; }
.daily-notes-chev {
  color: #b07908;
  font-size: 12px;
  transition: transform .2s;
}
details[open] .daily-notes-chev { transform: rotate(180deg); }
.daily-notes-body {
  padding: 12px 14px 14px;
  background: white;
  border-top: 1px solid #f0c987;
}
.daily-notes-content {
  font-size: 13px;
  color: var(--t2);
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* Feed cronológico — daily.php + detail.php (tab=activity)                */
/* ═══════════════════════════════════════════════════════════════════════ */
.act-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.act-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--border-l);
  color: var(--t3);
}
.act-chip-ok   { background: var(--mint-bg); color: var(--mint); }
.act-chip-warn { background: var(--amber-bg, #fdf6e7); color: var(--amber); }
.act-chip-dn   { background: var(--rust-bg); color: var(--rust); }
.act-chip-info { background: var(--ocean-bg); color: var(--ocean); }

.act-feed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px 14px;
}

.act-day {
  font-size: 10px;
  font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 0 6px;
  border-bottom: 0.5px solid var(--border-l);
  margin-bottom: 6px;
}
.act-day:first-child { padding-top: 4px; }

.act-row {
  display: grid;
  grid-template-columns: 46px 28px 1fr;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border-l);
}
.act-row:last-child { border-bottom: none; }

.act-time {
  font-size: 11px;
  color: var(--t4);
  padding-top: 4px;
  font-family: var(--font-mono, monospace);
}

.act-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
  font-weight: 600;
}
.act-ic-ok   { background: var(--mint); }
.act-ic-warn { background: var(--amber); color: white; }
.act-ic-dn   { background: var(--rust); }
.act-ic-info { background: var(--ocean); }

.act-body { min-width: 0; }

.act-title {
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.4;
}
.act-title strong { color: var(--t1); font-weight: 500; }
.act-task-link {
  color: var(--accent);
  text-decoration: none;
}
.act-task-link:hover { text-decoration: underline; }

.act-detail {
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 3px;
  padding: 5px 9px;
  background: var(--raised);
  border-left: 2px solid var(--border);
  border-radius: 3px;
  font-style: italic;
}

.act-context {
  font-size: 10px;
  color: var(--t4);
  margin-top: 3px;
}
.act-context a {
  color: var(--accent);
  text-decoration: none;
}
.act-context a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════ */
/* B2 — Pivot table mayoristas × CEDIS (workflows/detail.php?tab=wholes)   */
/* ═══════════════════════════════════════════════════════════════════════ */
.b2-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.b2-toolbar-title { font-size: 13px; color: var(--t1); }
.b2-toolbar-title strong { font-weight: 500; }
.b2-toolbar-meta { font-size: 11px; color: var(--t4); margin-left: 8px; }
.b2-legend { display: flex; gap: 12px; font-size: 11px; color: var(--t3); }
.b2-leg-i { display: flex; align-items: center; gap: 5px; }
.b2-cell-mini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 3px;
  font-size: 9px; font-weight: 600;
}

.b2-line { margin-bottom: 16px; }
.b2-line-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 13px;
  color: var(--t1);
}
.b2-line-head strong { font-weight: 500; }
.b2-line-count {
  font-size: 11px;
  color: var(--t4);
  background: var(--border-l);
  padding: 1px 8px;
  border-radius: 8px;
}

.b2-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.b2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.b2-table thead th {
  background: var(--raised);
  padding: 8px 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t3);
  border-bottom: 1px solid var(--border);
  border-right: 0.5px solid var(--border-l);
  white-space: nowrap;
}
.b2-table thead th:last-child { border-right: none; }
.b2-th-name { text-align: left !important; padding-left: 12px !important; min-width: 180px; }
.b2-th-meta { min-width: 120px; }
.b2-th-cedis { min-width: 60px; max-width: 100px; }

.b2-table tbody tr { border-bottom: 0.5px solid var(--border-l); }
.b2-table tbody tr:last-child { border-bottom: none; }
.b2-table tbody tr:hover { background: var(--raised); }
.b2-table tbody tr.b2-row-dn   { background: var(--rust-bg); }
.b2-table tbody tr.b2-row-dn:hover { background: var(--rust-bg); }
.b2-table tbody tr.b2-row-done { opacity: .75; }
.b2-table tbody tr.b2-row-pause { opacity: .65; }

.b2-table tbody td {
  padding: 8px 6px;
  text-align: center;
  border-right: 0.5px solid var(--border-l);
  vertical-align: middle;
}
.b2-table tbody td:last-child { border-right: none; }
.b2-td-name { text-align: left !important; padding-left: 12px !important; }
.b2-td-name strong { color: var(--t1); font-weight: 500; font-size: 12.5px; display: block; }
.b2-td-name-meta { font-size: 10px; color: var(--t4); margin-top: 2px; }

.b2-td-meta { font-size: 11px; }
.b2-td-meta-text { font-size: 10px; color: var(--t4); margin-top: 3px; }
.b2-mini-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  width: 80px;
  margin: 0 auto;
}
.b2-mini-bar-fill { height: 100%; background: var(--ocean); }
.b2-row-dn .b2-mini-bar-fill { background: var(--rust); }
.b2-row-done .b2-mini-bar-fill { background: var(--mint); }

.b2-td-cell { padding: 4px !important; }

.b2-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.b2-c-ok      { background: var(--mint); color: #fff; }
.b2-c-miss    { background: var(--rust); color: #fff; }
.b2-c-partial { background: var(--amber); color: #fff; }
.b2-c-na      { background: var(--border); color: var(--t4); font-weight: 400; }

.b2-pill-ok   { background: var(--mint-bg); color: var(--mint); }
.b2-pill-dn   { background: var(--rust-bg); color: var(--rust); }
.b2-pill-done { background: var(--mint-bg); color: var(--mint); }
.b2-pill-pause { background: var(--border); color: var(--t3); }

/* ═══════════════════════════════════════════════════════════════════════ */
/* Z1 — Drilldown jerárquico de campañas (workflows/index.php)             */
/* Campaña → Mayoristas → CEDIS+archivos                                   */
/* ═══════════════════════════════════════════════════════════════════════ */
.z1-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 800px) { .z1-kpis { grid-template-columns: repeat(2, 1fr); } }
.z1-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--mid);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.z1-kpi.z1-kpi-info { border-left-color: var(--ocean); }
.z1-kpi.z1-kpi-danger { border-left-color: var(--rust); }
.z1-kpi.z1-kpi-warn { border-left-color: var(--amber); }
.z1-kpi-val {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  color: var(--t1);
}
.z1-kpi.z1-kpi-danger .z1-kpi-val { color: var(--rust); }
.z1-kpi.z1-kpi-warn .z1-kpi-val { color: var(--amber); }
.z1-kpi-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 6px;
}
.z1-kpi-desc { font-size: 11px; color: var(--t4); margin-top: 2px; }

.z1-list { display: flex; flex-direction: column; gap: 6px; }

.z1-camp {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.z1-camp:hover { border-color: var(--mid); }
/* Cuando una campaña está expandida, sombra sutil que la separa del resto */
.z1-camp.expanded {
  box-shadow: 0 2px 10px rgba(13, 107, 94, 0.08);
  border-color: var(--mid);
}

.z1-camp-h {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 12px 1.5fr 180px 100px 1fr 24px;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
}
.z1-camp-h:hover { background: var(--raised); }
.z1-h-dn .z1-camp-h { background: var(--rust-bg); }
.z1-h-wn .z1-camp-h { background: var(--amber-bg, #fdf6e7); }

/* Dot circular en vez de barra gruesa — más sutil */
.z1-camp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px var(--mint-bg);
}
.z1-h-dn .z1-camp-dot { background: var(--rust); box-shadow: 0 0 0 3px var(--rust-bg); }
.z1-h-wn .z1-camp-dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg, #fdf6e7); }
.z1-h-done .z1-camp-dot { background: var(--mint); }
.z1-h-pause .z1-camp-dot { background: var(--mid); box-shadow: 0 0 0 3px var(--border-l); }

.z1-camp-name strong { display: block; color: var(--t1); font-weight: 500; font-size: 13.5px; }
.z1-camp-meta { font-size: 11px; color: var(--t4); margin-top: 3px; }

.z1-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.z1-bar-fill { height: 100%; transition: width .3s; }
.z1-bar-fill.z1-bar-ok   { background: var(--mint); }
.z1-bar-fill.z1-bar-dn   { background: var(--rust); }
.z1-bar-fill.z1-bar-wn   { background: var(--amber); }
.z1-bar-fill.z1-bar-done { background: var(--mint); }
.z1-bar-fill.z1-bar-pause { background: var(--mid); }

.z1-camp-prog-meta, .z1-ws-prog-meta {
  font-size: 10px;
  color: var(--t4);
  margin-top: 3px;
}

.z1-camp-issues, .z1-ws-cedis-stat { font-size: 11px; color: var(--t3); }

.z1-issue-bad  { color: var(--rust); font-weight: 500; }
.z1-issue-warn { color: var(--amber); font-weight: 500; }
.z1-issue-ok   { color: var(--mint); }
.z1-issue-mute { color: var(--t4); }

.z1-chev {
  color: var(--t4);
  font-size: 14px;
  transition: transform .2s ease;
  text-align: center;
}
.z1-camp.expanded > .z1-camp-h .z1-chev,
.z1-ws.expanded > .z1-ws-h .z1-chev { transform: rotate(90deg); }

.z1-pill-ok   { background: var(--mint-bg); color: var(--mint); }
.z1-pill-dn   { background: var(--rust-bg); color: var(--rust); }
.z1-pill-wn   { background: #fdf6e7; color: var(--amber); }
.z1-pill-done { background: var(--mint-bg); color: var(--mint); }
.z1-pill-pause{ background: var(--border); color: var(--t3); }

.z1-camp-body {
  display: none;
  background: var(--raised);
  padding: 14px 18px 16px 32px;     /* Indentación izquierda para sensación de hijo */
  border-top: 1px solid var(--border-l);
  position: relative;
}
.z1-camp.expanded > .z1-camp-body { display: block; animation: z1-slide-down .25s ease-out; }
/* Línea guía vertical que conecta padre con hijos (tree line) */
.z1-camp-body::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 14px;
  bottom: 16px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--border-l) 100%);
  border-radius: 1px;
  opacity: 0.5;
}

@keyframes z1-slide-down {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.z1-ws-label {
  font-size: 10px;
  color: var(--t4);
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.z1-ws {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 6px;
  position: relative;
}
/* Conector horizontal del tree line al header del mayorista */
.z1-ws::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 22px;
  width: 13px;
  height: 2px;
  background: var(--border-l);
  border-radius: 1px;
}
.z1-ws.expanded {
  box-shadow: 0 1px 6px rgba(13, 107, 94, 0.06);
}

.z1-ws-h {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 10px 1.5fr 110px 140px 110px 24px;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  font-size: 11.5px;
}
.z1-ws-h:hover { background: var(--raised); }
.z1-h-dn .z1-ws-h { background: var(--rust-bg); }
.z1-h-wn .z1-ws-h { background: #fdf6e7; }

.z1-ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 2px var(--mint-bg);
}
.z1-h-dn .z1-ws-dot { background: var(--rust); box-shadow: 0 0 0 2px var(--rust-bg); }
.z1-h-wn .z1-ws-dot { background: var(--amber); box-shadow: 0 0 0 2px var(--amber-bg, #fdf6e7); }
.z1-h-done .z1-ws-dot { background: var(--mint); }
.z1-h-pause .z1-ws-dot { background: var(--mid); box-shadow: 0 0 0 2px var(--border-l); }

.z1-ws-name strong { color: var(--t1); font-weight: 500; font-size: 12.5px; }
.z1-ws-line {
  font-size: 10px;
  color: var(--t4);
  background: var(--border-l);
  padding: 1px 6px;
  border-radius: 5px;
  margin-left: 5px;
}
.z1-ws-meta { font-size: 10px; color: var(--t4); margin-top: 2px; }

.z1-ws-body {
  display: none;
  padding: 12px 14px 14px 28px;     /* Indentación adicional para CEDIS */
  background: linear-gradient(180deg, var(--raised) 0%, var(--surface) 100%);
  border-top: 1px dashed var(--border);
  position: relative;
}
.z1-ws.expanded > .z1-ws-body {
  display: block;
  animation: z1-slide-down .25s ease-out;
}
/* Línea guía interna para CEDIS (otro nivel de jerarquía) */
.z1-ws-body::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: var(--border-l);
}
.z1-cedis-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

.z1-cedis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
}
.z1-cedis-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}
.z1-cedis-card.z1-cedis-ok   { background: var(--mint-bg); border-color: var(--mint); }
.z1-cedis-card.z1-cedis-miss { background: var(--rust-bg); border-color: var(--rust); }
.z1-cedis-name { font-weight: 500; color: var(--t1); }
.z1-cedis-status { font-size: 10px; color: var(--t4); }
.z1-cedis-card.z1-cedis-ok .z1-cedis-status   { color: var(--mint); font-weight: 500; }
.z1-cedis-card.z1-cedis-miss .z1-cedis-status { color: var(--rust); font-weight: 500; }

.z1-cedis-empty {
  font-size: 11px;
  color: var(--t4);
  font-style: italic;
  padding: 8px 0;
}

.z1-ws-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 0.5px solid var(--border-l);
  font-size: 11px;
  color: var(--t4);
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Sección de Aprobaciones ─────────────────────────────────────── */
.approvals-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
.approval-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s;
}
.approval-card:hover { transform: translateY(-1px); }
.approval-card-rejected {
  border-left-color: var(--rust);
  opacity: .85;
}
.approval-card-title {
  font-weight: 500;
  color: var(--t1);
  font-size: 14px;
  margin-bottom: 2px;
}
.approval-card-meta {
  font-size: 11px;
  color: var(--t4);
}
.approval-card-desc {
  font-size: 12px;
  color: var(--t3);
  line-height: 1.45;
  padding: 8px 10px;
  background: var(--raised);
  border-radius: var(--radius-sm);
}
.approval-card-actions { margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════════════ */
/* PANEL EJECUTIVO — salud por campaña, atascos, carga del equipo          */
/* ═══════════════════════════════════════════════════════════════════════ */
.exec-panel {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.exec-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--t3);
  margin-bottom: 10px;
}

/* Salud de campañas — semáforos en grilla compacta */
.exec-health { margin-bottom: 16px; }
.exec-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.exec-health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, border-color .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exec-health-card:hover { transform: translateY(-1px); }
.exec-health-card.exec-ok    { border-left-color: var(--mint); }
.exec-health-card.exec-warn  { border-left-color: var(--amber); }
.exec-health-card.exec-danger{ border-left-color: var(--rust); background: var(--rust-bg); }
.exec-health-head { display: flex; align-items: center; gap: 6px; }
.exec-health-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.exec-dot-ok    { background: var(--mint); }
.exec-dot-warn  { background: var(--amber); }
.exec-dot-danger{ background: var(--rust); }
.exec-health-name {
  font-size: 13px; font-weight: 500; color: var(--t1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exec-health-bar {
  height: 3px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.exec-health-bar-fill {
  height: 100%; background: var(--accent); border-radius: 999px;
}
.exec-ok    .exec-health-bar-fill { background: var(--mint); }
.exec-warn  .exec-health-bar-fill { background: var(--amber); }
.exec-danger .exec-health-bar-fill { background: var(--rust); }
.exec-health-meta {
  display: flex; gap: 8px; font-size: 10px; color: var(--t4); align-items: center;
}
.exec-mini-bad {
  background: var(--rust-bg); color: var(--rust);
  padding: 1px 6px; border-radius: 999px; font-weight: 600;
}
.exec-mini-ok {
  color: var(--mint); font-weight: 500;
}

/* Layout en 2 columnas: atascos + carga */
.exec-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .exec-row { grid-template-columns: 1fr; }
}

/* Top atascos */
.exec-stuck-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}
.exec-stuck-row:hover { background: var(--raised); }
.exec-reason-danger { border-left-color: var(--rust); }
.exec-reason-warn   { border-left-color: var(--amber); }
.exec-reason-info   { border-left-color: var(--ocean); }
.exec-stuck-reason {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.exec-reason-danger .exec-stuck-reason { color: var(--rust); }
.exec-reason-warn   .exec-stuck-reason { color: var(--amber); }
.exec-reason-info   .exec-stuck-reason { color: var(--ocean); }
.exec-stuck-body { min-width: 0; }
.exec-stuck-title {
  font-size: 13px; font-weight: 500; color: var(--t1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exec-stuck-meta {
  font-size: 11px; color: var(--t3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exec-stuck-alertmsg { color: var(--rust); margin-left: 6px; font-weight: 500; }
.exec-stuck-pill { font-size: 10px; flex-shrink: 0; }

/* Carga del equipo */
.exec-load-row { margin-bottom: 8px; }
.exec-load-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; margin-bottom: 3px;
}
.exec-load-name { font-weight: 500; color: var(--t1); }
.exec-load-oof {
  font-size: 9px; background: var(--amber); color: white;
  padding: 1px 5px; border-radius: 999px; margin-left: 4px; font-weight: 600;
}
.exec-load-numbers { font-size: 11px; color: var(--t4); display: flex; gap: 8px; }
.exec-load-late { color: var(--rust); font-weight: 600; }
.exec-load-bar {
  height: 6px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.exec-load-bar-fill { height: 100%; border-radius: 999px; }
.exec-load-ok    { background: var(--mint); }
.exec-load-warn  { background: var(--amber); }
.exec-load-danger{ background: var(--rust); }

/* ── Campaign cards (grid) ────────────────────────────────────────────── */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
  align-items: start;          /* Cada card en su altura natural — no estira la fila */
}
@media (min-width: 1100px) {
  .campaign-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1500px) {
  .campaign-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Cuando una card está expandida (no .collapsed), ocupa todo el ancho.
   Así no deja huecos vacíos en las otras columnas de su fila. */
.campaign-grid > .campaign-card.collapsible:not(.collapsed) {
  grid-column: 1 / -1;
}

.campaign-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
  color: inherit;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}
.campaign-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.campaign-card-warn {
  border-color: var(--amber);
  border-width: 1px;
}
.campaign-card-warn:hover {
  border-color: var(--amber);
  box-shadow: 0 2px 12px rgba(176, 121, 8, .15);
}

.cc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.cc-titles { min-width: 0; flex: 1; }
.cc-client {
  font-size: 10px;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  margin-bottom: 2px;
}
.cc-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.25;
  /* Truncar a máximo 2 líneas con elipsis para uniformar altura entre cards */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.5em;  /* Reserva espacio para 2 líneas, así nombres cortos no aprietan la card */
}

.cc-progress { margin: 0; }
.cc-progress-label {
  font-size: 11px;
  color: var(--t4);
  margin-top: 4px;
}

.cc-divisions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.cc-div-pill {
  font-size: 10px;
  padding: 1px 7px;
  background: var(--raised);
  border-radius: 999px;
  color: var(--t2);
  white-space: nowrap;
}

.cc-wholesalers {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cc-ws-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.cc-ws-name {
  font-weight: 600;
  color: var(--t1);
  min-width: 70px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cc-ws-division {
  font-weight: 500;
  font-size: 10px;
  color: var(--t4);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--raised);
  border: 1px solid var(--border);
  text-transform: none;
  letter-spacing: 0;
}
.cc-ws-division-dup {
  background: var(--accent-l);
  color: var(--accent);
  border-color: var(--accent);
}
.cc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 10px;
  color: var(--t4);
  padding: 5px 10px;
  margin-bottom: 6px;
  background: var(--raised);
  border-radius: 6px;
}
.cc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cc-legend-item .train-seg {
  width: 14px;
  height: 14px;
  font-size: 9px;
  border-radius: 3px;
}
.cc-legend-item .train-seg.upcoming {
  border: 1px dashed var(--border);
}
.cc-cycles {
  display: inline-flex;
  gap: 3px;
  flex-wrap: wrap;
}
.cyc-pill {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.cyc-pill.cyc-done     { background: var(--mint-bg);  color: var(--mint); }
.cyc-pill.cyc-active   { background: var(--ocean-bg); color: var(--ocean); }
.cyc-pill.cyc-late     { background: var(--rust-bg);  color: var(--rust); }
.cyc-pill.cyc-upcoming { background: var(--raised);   color: var(--t4); }
.cc-ws-more {
  font-size: 11px;
  color: var(--t4);
  padding-left: 78px;
}

.cc-foot {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--t4);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: auto;
  flex-wrap: wrap;        /* Para que no envuelva fea al ancho ajustado */
  align-items: center;
}
.cc-foot > span { white-space: nowrap; }  /* Evita el wrap de "1 comentario / nuevo" en 2 líneas */

/* ── Kanban tareas ────────────────────────────────────────────────────── */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .kanban-grid { grid-template-columns: 1fr; }
}

.kanban-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.kc-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 12px;
}
.kc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kc-title { flex: 1; }
.kc-count {
  font-size: 11px;
  font-weight: 600;
  opacity: .8;
}
.kc-head-late {
  background: var(--rust-bg);
  color: var(--rust);
}
.kc-head-late .kc-dot { background: var(--rust); }

.kc-head-active {
  background: var(--ocean-bg);
  color: var(--ocean);
}
.kc-head-active .kc-dot { background: var(--ocean); }

.kc-head-pending {
  background: var(--raised);
  color: var(--t2);
}
.kc-head-pending .kc-dot { background: var(--t4); }

.kc-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kc-empty {
  padding: 16px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--t4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--raised);
}
.kc-more {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--accent);
  padding: 6px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-top: 2px;
}
.kc-more:hover {
  background: var(--accent-l);
  text-decoration: none;
}

.task-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.task-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.task-card-late {
  border-color: var(--rust);
  border-width: 1px;
}
.task-card-active {
  border-color: var(--ocean);
}
.task-card-extra {
  border-color: var(--violet);
}

.tc-title {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 3px;
  color: var(--t1);
  display: flex;
  align-items: center;
  gap: 4px;
}
.tc-bolt { color: var(--violet); flex-shrink: 0; }

.tc-context {
  font-size: 10.5px;
  color: var(--t4);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card-extra-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--violet-bg);
  color: var(--violet);
  border-radius: 999px;
  font-weight: 500;
}

.tc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
}
.tc-due-normal { color: var(--t4); }
.tc-due-late {
  color: var(--rust);
  font-weight: 600;
}

/* Color violet (para tareas extras) */
:root {
  --violet: #534AB7;
  --violet-bg: #EEEDFE;
}
[data-theme="dark"] {
  --violet: #9b94ff;
  --violet-bg: rgba(83, 74, 183, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════
   v4.2 — Trenecitos sólidos, doble barra, zoom expand, wizard amigable
   ═══════════════════════════════════════════════════════════════════════ */

/* Doble barra de progreso (trabajo vs tiempo) */
.dual-progress {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}
.dual-progress > div { flex: 1; min-width: 0; }
.dp-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--t4);
  margin-bottom: 3px;
}
.dp-label-val { font-weight: 600; color: var(--t1); }
.dp-label-val.danger { color: var(--rust); }
.dp-bar {
  position: relative;
  height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: visible;
}
.dp-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .3s;
}
.dp-bar-fill.work { background: var(--ocean); }
.dp-bar-fill.work.warning { background: var(--amber); }
.dp-bar-fill.time { background: var(--coral, #D85A30); }
.dp-marker {
  position: absolute;
  top: -2px;
  width: 1.5px;
  height: 9px;
  background: var(--t1);
  border-radius: 1px;
}

/* Trenecitos como segmentos sólidos */
.train-segments {
  display: flex;
  gap: 0;
  flex: 1;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
}
.train-seg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  line-height: 1;
}
.train-seg.done    { background: var(--mint); }
.train-seg.active  { background: var(--ocean); }
.train-seg.late    { background: var(--rust); }
.train-seg.upcoming{ background: transparent; color: var(--t4); }

/* Expansor del card de campaña */
.cc-expand-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--raised);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 6px;
  transition: background .15s;
}
.cc-expand-toggle:hover { background: var(--accent-l); }
.cc-expand-toggle.expanded { background: var(--accent-l); }
.cc-expand-chevron {
  font-size: 14px;
  color: var(--t4);
  transition: transform .2s;
  flex-shrink: 0;
}
.cc-expand-toggle.expanded .cc-expand-chevron { transform: rotate(90deg); }

/* Phase cards expandidas */
.phase-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
  margin: 6px 0 12px 24px;
  padding: 10px;
  background: var(--raised);
  border-radius: var(--radius-sm);
}
.phase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  transition: all .15s;
}
.phase-card:hover { border-color: var(--accent); }
.phase-card-label {
  font-size: 9px;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
  font-weight: 600;
}
.phase-card-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--t1);
}
.phase-card-bar {
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.phase-card-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.phase-card.done    { background: var(--mint-bg); border-color: var(--mint); }
.phase-card.done .phase-card-bar-fill { background: var(--mint); }
.phase-card.active  { background: var(--ocean-bg); border-color: var(--ocean); }
.phase-card.active .phase-card-bar-fill { background: var(--ocean); }
.phase-card.late    { background: var(--rust-bg); border-color: var(--rust); }
.phase-card.late .phase-card-bar-fill { background: var(--rust); }
.phase-card.upcoming { opacity: .55; }

/* Tarjeta seleccionada (click) — destaca con borde más grueso y un acento */
.phase-card-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  opacity: 1 !important;
}

/* Botón "+N más" para ir al detalle completo de avances */
.phase-card-more {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--t3);
}
.phase-card-more:hover { color: var(--accent); border-color: var(--accent); }
.phase-card-more .phase-card-label { color: inherit; }
.phase-card-more .phase-card-count { color: inherit; font-size: 9px; font-weight: 400; }

/* Lista de actividades inline del avance actual */
.activity-strip {
  background: var(--ocean-bg);
  border-left: 3px solid var(--ocean);
  padding: 12px;
  margin: 0 0 12px 24px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.activity-strip-label {
  font-size: 10px;
  color: var(--ocean);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  margin-bottom: 8px;
}
.activity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
}
.activity-row.current {
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin: 4px -4px;
  padding: 6px 8px;
}
.activity-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 14px;
}
.activity-icon.done { color: var(--mint); }
.activity-icon.active { color: var(--ocean); }
.activity-icon.pending { color: var(--t4); }

/* Pill de comentarios nuevos */
.comment-pill-new {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--violet-bg);
  color: var(--violet);
  border-radius: 999px;
  margin-left: 6px;
  font-weight: 500;
}

/* Card de campaña con badge "comentarios nuevos" */
.cc-foot-comments {
  color: var(--violet);
  font-weight: 600;
}

/* Borde + badge floating en task card con comentario nuevo */
.task-card-newcomment {
  border-color: var(--violet) !important;
  position: relative;
}
.task-card-newcomment::after {
  content: 'Nuevo';
  position: absolute;
  top: -6px;
  right: 10px;
  background: var(--violet);
  color: white;
  font-size: 9px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ── Pool de tareas ─────────────────────────────────────────────────── */
.pool-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--violet-bg);
  border: 1px solid var(--violet);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.pool-banner-icon {
  font-size: 22px;
  color: var(--violet);
}
.pool-banner-body { flex: 1; }
.pool-banner-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--violet);
}
.pool-banner-text {
  font-size: 12px;
  color: var(--t2);
  margin-top: 2px;
}

.taken-by-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ocean-bg);
  color: var(--ocean);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}
.taken-by-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ocean);
  color: white;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* ── Wizard amigable: opciones grandes con radio ────────────────────── */
.big-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.big-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
}
.big-option:hover { border-color: var(--accent); }
.big-option.selected {
  border-color: var(--accent);
  background: var(--accent-l);
}
.big-option input[type="radio"] { margin-top: 3px; flex-shrink: 0; }
.big-option-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 3px;
}
.big-option.selected .big-option-title { color: var(--accent); }
.big-option-desc {
  font-size: 11px;
  color: var(--t4);
  line-height: 1.5;
}
.big-option-example {
  font-size: 10px;
  color: var(--t4);
  margin-top: 6px;
  padding: 5px 7px;
  background: var(--raised);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border);
}

/* Botones pill para duration */
.pill-options {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.pill-option {
  font-size: 12px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.pill-option:hover { border-color: var(--accent); }
.pill-option.selected {
  background: var(--accent-l);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

/* Tooltip de ayuda */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--raised);
  color: var(--t4);
  font-size: 9px;
  font-weight: 600;
  margin-left: 4px;
  cursor: help;
  position: relative;
}
.help-tip:hover { background: var(--accent-l); color: var(--accent); }
.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--t1);
  color: var(--surface);
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  max-width: 250px;
  white-space: normal;
  width: max-content;
  margin-bottom: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 100;
  text-align: center;
  line-height: 1.4;
}
.help-tip:hover::after { opacity: 1; }

/* Wizard de pasos */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.wizard-step {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--t4);
  border-bottom: 3px solid transparent;
  transition: all .15s;
}
.wizard-step.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.wizard-step.done {
  color: var(--mint);
}
.wizard-step-num {
  display: inline-flex;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--raised);
  color: var(--t4);
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  margin-right: 6px;
}
.wizard-step.active .wizard-step-num { background: var(--accent); color: white; }
.wizard-step.done .wizard-step-num { background: var(--mint); color: white; }

/* Playbook items */
.playbook-item {
  display: flex;
  align-items: start;
  gap: 9px;
  padding: 9px 12px;
  background: var(--raised);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.playbook-item-q {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--t1);
}
.playbook-item-a {
  font-size: 12px;
  color: var(--t2);
  line-height: 1.5;
}

/* Branch options */
.branch-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 5px;
  cursor: pointer;
  transition: all .15s;
}
.branch-option:hover { border-color: var(--accent); }
.branch-option.success { border-color: var(--mint); background: var(--mint-bg); }
.branch-option.danger  { border-color: var(--rust); background: var(--rust-bg); }
.branch-option.warning { border-color: var(--amber); background: var(--amber-bg); }
.branch-icon { flex-shrink: 0; font-size: 14px; }

/* Video y documentación en actividad */
.activity-video {
  margin: 12px 0;
  padding: 12px;
  background: var(--raised);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--violet);
}
.activity-video-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--violet);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.activity-doc {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--accent-l);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.6;
  color: var(--t2);
}

/* Time progress label colors */
.time-late { color: var(--rust); font-weight: 600; }

/* Coral color para tiempo */
:root {
  --coral: #D85A30;
  --coral-bg: #FAECE7;
}
[data-theme="dark"] {
  --coral: #F0997B;
  --coral-bg: rgba(216, 90, 48, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════
   v4.2.2 — Parche: selector área, single progress, pool destacado,
   archivos+CEDIS inline, módulo incidencias
   ═══════════════════════════════════════════════════════════════════════ */

/* Selector de área (header) */
.area-selector {
  display: inline-flex;
  align-items: center;
  background: var(--raised);
  border-radius: var(--radius-sm);
  padding: 2px 8px 2px 12px;
  border: 1px solid var(--border);
  font-size: 12px;
}
.area-selector-label {
  color: var(--t4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  margin-right: 6px;
}
.area-selector-select {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--t1);
  font-weight: 500;
  padding: 4px 4px;
  cursor: pointer;
  outline: none;
}
.area-selector-select:focus { color: var(--accent); }

/* Single progress (sin tiempo) */
.single-progress { margin-bottom: 12px; }
.cc-days-left {
  font-size: 11px;
  color: var(--t4);
  margin-top: 6px;
}

/* Sección pool destacada (arriba del kanban) */
.pool-section {
  background: var(--violet-bg);
  border: 1px solid var(--violet);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}

/* Pool del equipo (vista gerentes/director): paleta amber para distinguirlo del pool propio */
.pool-team-section {
  background: var(--amber-bg, #fdf6e7);
  border-color: var(--amber);
}
.pool-team-section .pool-section-title { color: var(--amber); }
.pool-team-section .pool-section-counter { background: var(--amber); }
.pool-team-card { border-color: var(--amber); }
.pool-team-card:hover { background: var(--amber-bg, #fdf6e7); }
.pool-team-role {
  font-size: 11px;
  color: var(--t3);
  margin-top: 4px;
}
.pool-team-role strong { color: var(--amber); }
.pool-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.pool-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--violet);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pool-section-counter {
  background: var(--violet);
  color: white;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.pool-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.pool-task-card {
  background: var(--surface);
  border: 1px solid var(--violet);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.pool-task-card:hover {
  background: var(--violet-bg);
  text-decoration: none;
  transform: translateY(-1px);
}
.pool-task-title {
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--t1);
}
.pool-task-meta {
  font-size: 10.5px;
  color: var(--t4);
  margin-bottom: 5px;
}
.pool-task-deadline {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  display: inline-block;
}
.pool-deadline-urgent { background: var(--rust-bg); color: var(--rust); }
.pool-deadline-soon   { background: var(--amber-bg); color: var(--amber); }
.pool-deadline-normal { background: var(--raised); color: var(--t4); }

/* Archivos y CEDIS inline en actividad expandida */
.inline-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
  padding: 10px;
  background: var(--raised);
  border-radius: var(--radius-sm);
}
.inline-check-block {
  min-width: 0;
}
.inline-check-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  margin-bottom: 5px;
}
.inline-check-count-done { color: var(--mint); font-weight: 700; }
.inline-check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 3px 8px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 3px;
}
.inline-check-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--t4);
  background: transparent;
  flex-shrink: 0;
}
.inline-check-dot.done {
  background: var(--mint);
  border-color: var(--mint);
}
.inline-check-row.done {
  color: var(--t4);
  text-decoration: line-through;
}
.inline-check-empty {
  font-size: 10px;
  color: var(--t4);
  text-align: center;
  padding: 4px;
}

/* Módulo Incidencias */
.incident-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--t4);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px;
  transition: box-shadow .15s;
}
.incident-card:hover { box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.incident-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--violet-bg);
  color: var(--violet);
  font-weight: 500;
}

/* Plantilla edit: contenedor ancho */
.template-edit-content {
  max-width: 100%;
  overflow-x: hidden;
}
.template-edit-content .form-row,
.template-edit-content .form-row-3 {
  width: 100%;
  max-width: 100%;
}

/* Notificaciones paginadas */
.notif-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.notif-pagination a {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--t2);
  text-decoration: none;
}
.notif-pagination a.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.notif-pagination a:hover { border-color: var(--accent); text-decoration: none; }

/* Page header con selector y actions */
.page-header { gap: 16px; }
.page-header .page-title { flex: 1; }

/* ════════════════════════════════════════════════════════════════════ */
/* Avances por mayorista — rediseño v4.3                                */
/* ════════════════════════════════════════════════════════════════════ */

/* ─── Tab "Progreso por fase": cards de mayoristas con barras ─── */
.ws-train-row {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.ws-train-row:first-child { border-top: none; }
.ws-train-info {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ws-train-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--t1);
}
.ws-train-cadence {
  font-size: 10px;
  color: var(--t4);
}
.ws-train {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.advance-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 58px;
  padding: 6px 8px;
  border-radius: 7px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--raised);
  transition: transform .1s, border-color .15s;
}
.advance-mini:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}
.advance-mini-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
}
.advance-mini-num { color: var(--t1); }
.advance-mini-icon { font-size: 11px; }
.advance-mini-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.advance-mini-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}
.advance-mini-count {
  font-size: 10px;
  color: var(--t4);
  text-align: right;
}

/* Variantes de estado */
.advance-mini.done {
  background: var(--mint-bg);
  border-color: var(--mint);
}
.advance-mini.done .advance-mini-icon { color: var(--mint); }
.advance-mini.done .advance-mini-bar-fill { background: var(--mint); }

.advance-mini.active {
  background: var(--ocean-bg);
  border-color: var(--ocean);
}
.advance-mini.active .advance-mini-icon { color: var(--ocean); }
.advance-mini.active .advance-mini-bar-fill { background: var(--ocean); }

.advance-mini.late {
  background: var(--rust-bg);
  border-color: var(--rust);
}
.advance-mini.late .advance-mini-icon { color: var(--rust); }
.advance-mini.late .advance-mini-bar-fill { background: var(--rust); }

.advance-mini.upcoming {
  opacity: .65;
}
.advance-mini.upcoming .advance-mini-bar-fill { background: var(--t4); }

/* ─── Tab "Avances por mayorista": layout completo ─── */
.line-block {
  margin-bottom: 22px;
}
.line-block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--accent-l);
  border-radius: var(--radius) var(--radius) 0 0;
  border-left: 3px solid var(--accent);
}
.line-block-icon { font-size: 14px; }
.line-block-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--t1);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.line-block-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--t4);
}

.ws-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  padding: 14px;
}
.ws-block:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}
.ws-block-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ws-block-info {
  flex: 1;
  min-width: 200px;
}
.ws-block-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--t1);
}
.ws-block-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--t4);
}
.ws-cadence-pill, .ws-day-pill {
  padding: 2px 8px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 500;
  color: var(--t2);
}
.ws-cycles-count {
  margin-left: auto;
}
.ws-block-progress {
  min-width: 200px;
  text-align: right;
}
.ws-block-bar {
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.ws-block-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--ocean));
  border-radius: 4px;
  transition: width .3s;
}
.ws-block-pct {
  font-size: 11px;
  color: var(--t4);
  font-weight: 500;
}

/* Grid de cycles dentro de un mayorista */
.ws-cycles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.cycle-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--raised);
  transition: border-color .15s, transform .1s;
  overflow: hidden;
}
.cycle-card:hover { transform: translateY(-1px); }
.cycle-card-summary {
  cursor: pointer;
  padding: 10px 12px;
  list-style: none;
}
.cycle-card-summary::-webkit-details-marker { display: none; }
.cycle-card-summary::marker { content: ''; }

.cycle-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.cycle-card-num {
  font-weight: 700;
  font-size: 13px;
  color: var(--t1);
}
.cycle-card-icon {
  font-size: 14px;
}
.cycle-card-bar {
  height: 5px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.cycle-card-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}
.cycle-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}
.cycle-card-state {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t3);
}
.cycle-card-count {
  color: var(--t4);
  font-weight: 600;
}

/* Variantes */
.cycle-card-done {
  border-color: var(--mint);
  background: var(--mint-bg);
}
.cycle-card-done .cycle-card-icon,
.cycle-card-done .cycle-card-state { color: var(--mint); }
.cycle-card-done .cycle-card-bar-fill { background: var(--mint); }

.cycle-card-active {
  border-color: var(--ocean);
  background: var(--ocean-bg);
}
.cycle-card-active .cycle-card-icon,
.cycle-card-active .cycle-card-state { color: var(--ocean); }
.cycle-card-active .cycle-card-bar-fill { background: var(--ocean); }

.cycle-card-late {
  border-color: var(--rust);
  background: var(--rust-bg);
}
.cycle-card-late .cycle-card-icon,
.cycle-card-late .cycle-card-state { color: var(--rust); }
.cycle-card-late .cycle-card-bar-fill { background: var(--rust); }

.cycle-card-upcoming {
  opacity: .7;
}
.cycle-card-upcoming .cycle-card-bar-fill { background: var(--t4); }

/* Body desplegable */
.cycle-card-body {
  padding: 0 12px 10px 12px;
  border-top: 1px dashed var(--border);
  background: var(--surface);
}
.cycle-task-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  grid-template-areas:
    "num title pill"
    ".   assig assig";
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
  color: var(--t2);
  text-decoration: none;
  border-bottom: 1px solid var(--border-l);
}
.cycle-task-row > .step-num { grid-area: num; }
.cycle-task-row > .pill {
  grid-area: pill;
  justify-self: end;
  flex-shrink: 0;
  font-size: 10px;
  padding: 1px 7px;
  white-space: nowrap;
}
.cycle-task-row:last-child { border-bottom: none; }
.cycle-task-row:hover .cycle-task-title { color: var(--accent); }
.cycle-task-title {
  grid-area: title;
  min-width: 0;
  word-break: break-word;
  line-height: 1.35;
}
.cycle-task-assignee {
  grid-area: assig;
  font-size: 10px;
  color: var(--t4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ════════════════════════════════════════════════════════════════════ */
/* Timeline de trazabilidad — task.php                                  */
/* ════════════════════════════════════════════════════════════════════ */
.timeline {
  padding: 14px 18px 18px 18px;
  position: relative;
}
.timeline-item {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 8px 0;
}
.timeline-item:last-child .timeline-line { display: none; }

.timeline-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .03em;
  z-index: 2;
}
.timeline-line {
  position: absolute;
  left: 14px;
  top: 38px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
  z-index: 1;
}
.timeline-body {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
}
.timeline-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  line-height: 1.4;
}
.timeline-icon { font-size: 13px; }
.timeline-user {
  color: var(--t1);
  font-weight: 600;
}
.timeline-action {
  color: var(--t2);
}
.timeline-time {
  margin-left: auto;
  font-size: 10px;
  color: var(--t4);
  white-space: nowrap;
}
.timeline-detail {
  margin-top: 3px;
  font-size: 11px;
  color: var(--t3);
}
.timeline-old {
  text-decoration: line-through;
  color: var(--t4);
}
.timeline-new {
  font-weight: 500;
  color: var(--t2);
}
.timeline-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--t3);
  padding: 5px 9px;
  background: var(--raised);
  border-left: 2px solid var(--border);
  border-radius: 3px;
  font-style: italic;
}

/* ════════════════════════════════════════════════════════════════════ */
/* Mis tareas — sección visible en dashboard                            */
/* ════════════════════════════════════════════════════════════════════ */
.my-tasks-section {
  margin: 18px 0 22px;
}
.my-tasks-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.my-tasks-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--t3);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.my-tasks-tab:hover {
  color: var(--t1);
}
.my-tasks-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.my-tasks-tab.danger {
  color: var(--rust);
}
.my-tasks-tab.danger.active {
  border-bottom-color: var(--rust);
}
.my-tasks-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--raised);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
}
.my-tasks-tab.active .my-tasks-count {
  background: var(--accent);
  color: white;
}
.my-tasks-tab.danger.active .my-tasks-count {
  background: var(--rust);
  color: white;
}
.my-tasks-tab:not(.has-items) {
  opacity: .55;
}
.my-tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}
.empty-state-mini {
  padding: 24px;
  text-align: center;
  color: var(--t4);
  font-size: 13px;
  grid-column: 1 / -1;
  background: var(--raised);
  border-radius: var(--radius);
}

/* ════════════════════════════════════════════════════════════════════ */
/* Banner rojo de tareas atrasadas — urgencia visible inmediatamente    */
/* ════════════════════════════════════════════════════════════════════ */
.overdue-banner {
  background: var(--rust-bg);
  border-left: 4px solid var(--rust);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 14px 0 20px;
}
.overdue-banner-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--rust);
}
.overdue-banner-icon {
  font-size: 18px;
}
.overdue-banner-head strong {
  flex: 1;
  font-weight: 600;
}
.overdue-banner-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--rust);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--rust);
  border-radius: 6px;
  background: transparent;
  transition: background .15s;
}
.overdue-banner-link:hover {
  background: var(--rust);
  color: #fff;
}
.overdue-banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

/* ════════════════════════════════════════════════════════════════════ */
/* Chips de métricas delgados — barra superior del dashboard            */
/* ════════════════════════════════════════════════════════════════════ */
.metric-strip {
  display: flex;
  gap: 10px;
  margin: 8px 0 16px;
  flex-wrap: wrap;
}
.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  text-decoration: none;
  color: var(--t1);
  transition: border-color .15s, transform .1s;
  min-width: 120px;
}
.metric-chip:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}
.metric-chip-val {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
}
.metric-chip-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--t4);
  font-weight: 500;
}
.metric-chip.warning {
  background: var(--amber-bg, rgba(245,158,11,.1));
  border-color: var(--amber);
}
.metric-chip.warning .metric-chip-val { color: var(--amber); }
.metric-chip.danger {
  background: var(--rust-bg);
  border-color: var(--rust);
}
.metric-chip.danger .metric-chip-val { color: var(--rust); }

/* ════════════════════════════════════════════════════════════════════ */
/* Cards de campaña — versión compacta                                  */
/* ════════════════════════════════════════════════════════════════════ */
.campaign-card {
  padding: 14px 14px 12px;
}
.campaign-card .cc-name {
  font-size: 14px;
  line-height: 1.25;
}
.campaign-card .cc-client {
  font-size: 10px;
  margin-bottom: 2px;
}
.campaign-card .single-progress {
  margin: 10px 0 8px;
}
.campaign-card .dp-label {
  font-size: 11px;
  margin-bottom: 4px;
}
.campaign-card .cc-days-left {
  font-size: 10px;
  margin-top: 4px;
}
/* Divisiones más pequeñas */
.campaign-card .cc-div-pill {
  font-size: 10px;
  padding: 2px 7px;
}
.campaign-card .cc-divisions {
  gap: 5px;
  margin-bottom: 8px;
}
/* Leyenda compacta */
.campaign-card .cc-legend {
  padding: 4px 8px;
  margin-bottom: 5px;
  gap: 8px;
}
.campaign-card .cc-legend-item {
  font-size: 9px;
}
.campaign-card .cc-legend-item .train-seg {
  width: 12px;
  height: 12px;
  font-size: 8px;
}
/* Toggle de mayoristas más delgado */
.campaign-card .cc-expand-toggle {
  padding: 6px 8px;
  font-size: 12px;
}
.campaign-card .train-seg {
  width: 18px;
  height: 18px;
  font-size: 10px;
}
/* Footer compacto */
.campaign-card .cc-footer {
  font-size: 10px;
  padding-top: 8px;
  margin-top: 8px;
}

/* ════════════════════════════════════════════════════════════════════ */
/* Cards de campaña — colapsables                                       */
/* ════════════════════════════════════════════════════════════════════ */
.campaign-card.collapsible .cc-head-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.cc-toggle-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--t3);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.cc-toggle-btn:hover {
  background: var(--accent-l);
  color: var(--accent);
  border-color: var(--accent);
}
.cc-toggle-chevron {
  transition: transform .25s ease;
}
.campaign-card.collapsed .cc-toggle-chevron {
  transform: rotate(-90deg);
}
.cc-collapsible-body {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height .35s ease, opacity .2s ease, margin .2s ease;
  opacity: 1;
}
.campaign-card.collapsed .cc-collapsible-body {
  max-height: 0;
  opacity: 0;
  margin: 0;
}
/* Cuando está colapsada, el footer se pega al progress */
.campaign-card.collapsed .cc-foot {
  margin-top: 6px;
}

/* Alto mínimo en cards colapsadas para uniformar la grilla cuando hay varias */
.campaign-card.collapsible.collapsed {
  min-height: 165px;
}

/* ════════════════════════════════════════════════════════════════════ */
/* Matriz de permisos — admin/permissions tab                           */
/* ════════════════════════════════════════════════════════════════════ */
.permissions-matrix {
  width: 100%;
  border-collapse: collapse;
}
.permissions-matrix th {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 12px 10px;
  color: var(--t3);
  background: var(--raised);
  border-bottom: 2px solid var(--border);
}
.permissions-matrix td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.permissions-matrix tbody tr:hover {
  background: var(--raised);
}
.perm-name {
  font-weight: 600;
  color: var(--t1);
  font-size: 13px;
  margin-bottom: 2px;
}
.perm-desc {
  font-size: 11px;
  color: var(--t4);
}
.perm-cell {
  text-align: center;
}

/* Switch toggle */
.perm-toggle {
  display: inline-block;
  position: relative;
  width: 38px;
  height: 20px;
  cursor: pointer;
}
.perm-toggle.locked {
  cursor: not-allowed;
  opacity: .6;
}
.perm-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.perm-toggle-slider {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--border);
  border-radius: 999px;
  transition: background .2s;
  position: relative;
}
.perm-toggle-slider::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.perm-toggle input:checked + .perm-toggle-slider {
  background: var(--mint);
}
.perm-toggle input:checked + .perm-toggle-slider::before {
  transform: translateX(18px);
}

/* ════════════════════════════════════════════════════════════════════ */
/* LOGIN v4.3 — split-screen profesional                                */
/* ════════════════════════════════════════════════════════════════════ */
.login-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg, #faf7f2);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--t1);
}
.login-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
}

/* ─── Hero izquierda ─── */
.login-hero {
  position: relative;
  background: linear-gradient(135deg, #0d6b5e 0%, #114c44 50%, #0a3530 100%);
  color: #fff;
  padding: 56px 56px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.login-hero-bg svg {
  width: 100%;
  height: 100%;
  display: block;
}
.login-hero-content {
  position: relative;
  z-index: 1;
  max-width: 460px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 80px;
}
.login-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.login-brand-name {
  font-family: 'Bricolage Grotesque', serif;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -.02em;
}
.login-hero-headline h1 {
  font-family: 'Bricolage Grotesque', serif;
  font-size: 52px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -.03em;
  margin: 0 0 18px;
  color: #fff;
}
.login-hero-accent {
  background: linear-gradient(90deg, #6ee7b7, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-hero-tagline {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(255,255,255,.78);
  margin: 0 0 36px;
  max-width: 420px;
}
.login-hero-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-hero-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255,255,255,.88);
}
.lhf-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(110, 231, 183, .18);
  color: #6ee7b7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.login-hero-foot {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: rgba(255,255,255,.5);
  margin-top: 28px;
}

/* ─── Formulario derecha ─── */
.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}
.login-form-card {
  width: 100%;
  max-width: 420px;
}
.login-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  font-family: 'Bricolage Grotesque', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 32px;
}
.login-form-head {
  margin-bottom: 28px;
}
.login-form-head h2 {
  font-family: 'Bricolage Grotesque', serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  color: var(--t1);
}
.login-form-head p {
  margin: 0;
  font-size: 14px;
  color: var(--t3);
}

.login-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-alert-error {
  background: var(--rust-bg);
  color: var(--rust);
  border: 1px solid rgba(0,0,0,.05);
}
.login-alert-success {
  background: var(--mint-bg);
  color: var(--mint);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  letter-spacing: .01em;
}
.login-forgot {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.login-forgot:hover {
  text-decoration: underline;
}
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-icon {
  position: absolute;
  left: 13px;
  color: var(--t4);
  pointer-events: none;
  display: flex;
}
.login-input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--t1);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.login-input::placeholder {
  color: var(--t4);
  font-size: 13px;
}
.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,107,94,.12);
}
.login-toggle-pass {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--t4);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
}
.login-toggle-pass:hover {
  background: var(--raised);
  color: var(--t2);
}

.login-submit {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .15s;
  font-family: inherit;
}
.login-submit:hover {
  background: #094f44;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13,107,94,.25);
}
.login-submit:active {
  transform: translateY(0);
}

.login-theme-toggle {
  margin-top: 24px;
  text-align: center;
}
.login-theme-toggle button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--t4);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.login-theme-toggle button:hover {
  color: var(--t1);
  border-color: var(--t3);
}

/* ─── Responsive: en pantalla angosta el hero desaparece ─── */
@media (max-width: 900px) {
  .login-split {
    grid-template-columns: 1fr;
  }
  .login-hero {
    display: none;
  }
  .login-mobile-brand {
    display: flex;
    justify-content: center;
  }
  .login-form-card {
    max-width: 380px;
  }
}
@media (max-width: 480px) {
  .login-form-wrap {
    padding: 24px 18px;
  }
  .login-form-head h2 {
    font-size: 24px;
  }
}

/* Dark mode adjustments */
[data-theme="dark"] .login-body {
  background: #0f1110;
}
[data-theme="dark"] .login-input {
  background: var(--surface);
}
[data-theme="dark"] .login-hero {
  background: linear-gradient(135deg, #0a4943 0%, #061d1a 60%, #03100e 100%);
}

/* ── Responsive topbar (móvil/tablet) ──────────────────────────────────── */
@media (max-width: 900px) {
  .topbar { padding: 0 12px; }
  .topbar-l { gap: 10px; }
  .topbar-search { display: none; }
  .topbar-area-select { max-width: 110px; font-size: 11px; }
  .topbar-brand span { display: none; }
  .topbar-nav-item { padding: 0 10px; font-size: 12px; }
}

/* ── Hamburger + drawer móvil (≤700px) ─────────────────────────────────── */
.topbar-burger {
  display: none;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.topbar-burger:hover { background: rgba(255,255,255,0.08); }
.topbar-overlay {
  display: none;
  position: fixed;
  left: 0; right: 0;
  top: calc(48px + env(safe-area-inset-top, 0px));   /* arranca DEBAJO del topbar */
  bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 89;
  opacity: 0;
  pointer-events: none !important;          /* NUNCA bloquea clics por default */
  transition: opacity .2s;
}
.topbar-overlay.open {
  display: block;
  opacity: 1;
  pointer-events: auto !important;
}

@media (max-width: 700px) {
  .topbar-burger { display: inline-flex; }
  /* El overlay solo aparece cuando .open — manejado en regla base */

  .topbar-nav {
    position: fixed;
    top: calc(50px + env(safe-area-inset-top, 0px));
    left: 0;
    width: 62%;
    max-width: 260px;
    height: calc(100vh - 50px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    background: var(--raised, #fff);
    color: var(--t1, #1c2025);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 0;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .22s ease-out;
    box-shadow: 4px 0 18px rgba(0,0,0,0.25);
    z-index: 90;
  }
  .topbar-nav.open { transform: translateX(0); }
  .topbar-nav-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: 12.5px;
    color: var(--t1, #1c2025) !important;
    border-bottom: 1px solid var(--border-l, #eee);
    white-space: normal;
    height: auto;
    min-height: 36px;
    line-height: 1.2;
  }
  .topbar-nav-item.active {
    background: var(--ocean-bg, #e7f3ef);
    border-bottom-color: var(--ocean, #0d6b5e);
    font-weight: 600;
  }
  /* Selector de área visible dentro del drawer */
  #tf-topbar-nav .topbar-area-form,
  .topbar-nav .topbar-area-form {
    