/* PMO Melius — Estilos v2 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import 'tokens.css';

/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; line-height: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ─── Transición de tema ("gota de agua") ───────────────
   toggleTheme() en app.js anima el clip-path de ::view-transition-new(root) con un
   círculo que crece desde el punto del clic. La animación de cross-fade por defecto de
   la View Transitions API compite visualmente con eso — se desactiva aquí para que solo
   se vea el círculo expandiéndose, no un fundido superpuesto. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-surface-4); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--c-muted); }

/* ─── Ruido de fondo ─────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
}
[data-theme="light"] body::before { opacity: 0; }

/* ─── Gradientes de ambiente ─────────────────────────── */
body::after {
  content: '';
  position: fixed; z-index: 0; pointer-events: none;
  top: -30%; left: -10%;
  width: 60vw; height: 60vw;
  background: radial-gradient(ellipse at center, rgba(124,106,247,0.05) 0%, transparent 65%);
}
[data-theme="light"] body::after {
  background: radial-gradient(ellipse at center, rgba(108,92,231,0.06) 0%, transparent 65%);
}

/* ─── Layout shell ───────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
  position: relative; z-index: 1;
  transition: grid-template-columns var(--dur-normal) var(--ease-out),
              padding-right var(--dur-normal) var(--ease-out);
}
.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}
.app-shell.panel-open {
  padding-right: min(var(--right-panel-w), 92vw);
}

/* ─── Topbar ─────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--s-5);
  background: var(--c-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 40;
  gap: var(--s-3);
}
.topbar__left { display: flex; align-items: center; gap: var(--s-3); flex: 1; min-width: 0; }
.topbar__title {
  font-size: var(--t-base);
  font-weight: 700;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__search {
  display: flex; align-items: center; gap: var(--s-2);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: var(--s-2) var(--s-3);
  flex: 1; max-width: 320px;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.topbar__search:focus-within {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-dim);
}
.topbar__search input {
  background: none; border: none; outline: none;
  color: var(--c-text); font-size: var(--t-sm);
  width: 100%;
}
.topbar__search input::placeholder { color: var(--c-text-3); }
.topbar__search svg { color: var(--c-text-3); flex-shrink: 0; }
.topbar__actions { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }

/* Hamburguesa — solo visible en mobile (<768px) */
.topbar__hamburger {
  display: none;
  padding: var(--s-2);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.topbar__hamburger:hover { background: var(--c-surface-3); color: var(--c-text); }
@media (min-width: 769px) {
  .topbar__hamburger { display: none !important; }
}

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  display: flex; flex-direction: column;
  background: var(--c-surface-1);
  border-right: 1px solid var(--c-border);
  padding: var(--s-5) 0 0;
  position: sticky; top: 0; height: 100vh;
  overflow: hidden;
  transition: width var(--dur-normal) var(--ease-out),
              transform var(--dur-normal) var(--ease-out);
  z-index: 50;
}
/* Logo (arriba) y proyecto activo/usuario (abajo) quedan fijos; solo la lista de navegación
   hace scroll interno cuando no cabe entera — antes .sidebar completo scrolleaba junto,
   pudiendo cortar el logo o la tarjeta de usuario en pantallas bajas con muchos ítems/secciones. */
#sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar__logo,
.sidebar__user,
.sidebar__collapse-btn {
  flex-shrink: 0;
}
.sidebar--collapsed { width: var(--sidebar-collapsed); }
.sidebar__logo {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-5) var(--s-5);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-3);
  overflow: hidden;
}
.sidebar__logo-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff;
  box-shadow: var(--shadow-glow-sm);
  flex-shrink: 0;
}
.sidebar__logo-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
  overflow: hidden;
}
.sidebar__logo-symbol {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px;
}
.sidebar__logo-symbol-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* PNG con fondo transparente — se ve igual en dark y light */
}
.sidebar__logo-texts {
  min-width: 0;
  overflow: hidden;
}
.sidebar__logo-text {
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--c-text);
  white-space: nowrap;
  -webkit-text-fill-color: unset;
}
.sidebar__logo-pmo {
  font-weight: 800;
  color: var(--c-primary);
  letter-spacing: 0.06em;
  font-size: var(--t-xs);
  vertical-align: middle;
  margin-left: 2px;
}
.sidebar__logo-sub {
  font-size: var(--t-2xs);
  color: var(--c-text-3);
  margin-top: 1px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.sidebar__section {
  margin-top: var(--s-4);
  padding: 0 var(--s-4) var(--s-2);
  font-size: var(--t-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text-3);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar__section:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  margin: 1px var(--s-2);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  color: var(--c-text-2);
  transition: background var(--dur-fast) ease,
              color var(--dur-fast) ease,
              box-shadow var(--dur-normal) ease;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--c-surface-3); color: var(--c-text); }
.nav-item.active {
  background: var(--c-primary-dim-hi);
  color: var(--c-primary-light);
  box-shadow: inset 3px 0 0 var(--c-primary);
}
.nav-item__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity var(--dur-fast) ease;
}
.nav-item:hover .nav-item__icon,
.nav-item.active .nav-item__icon { opacity: 1; }
.nav-item__label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item__badge {
  margin-left: auto;
  background: var(--c-primary);
  color: #fff;
  font-size: var(--t-2xs); font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-full);
  min-width: 18px; text-align: center;
  flex-shrink: 0;
}

/* Usuario en sidebar */
.sidebar__user {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--c-border);
  display: flex; align-items: center; gap: var(--s-2);
  overflow: hidden;
}
.sidebar__user-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar__user-name {
  font-size: var(--t-xs); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar__user-role { font-size: var(--t-2xs); color: var(--c-text-3); }

/* ── Sidebar colapsable ──────────────────────────────── */
.sidebar__collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: none; border: 1px solid var(--c-border);
  color: var(--c-text-3); cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-normal) var(--ease-out);
  flex-shrink: 0;
  margin: var(--s-3) auto;
  align-self: center;
}
.sidebar__collapse-btn:hover { background: var(--c-surface-3); color: var(--c-text); }
.sidebar.sidebar--collapsed .sidebar__collapse-btn { transform: rotate(180deg); }
/* En móvil (drawer) el botón colapsar no tiene función — se oculta */
@media (max-width: 900px) {
  .sidebar__collapse-btn { display: none !important; }
}

/* Ocultar textos y badges en modo colapsado */
.sidebar.sidebar--collapsed .sidebar__logo-texts,
.sidebar.sidebar--collapsed .sidebar__section,
.sidebar.sidebar--collapsed .nav-item__label,
.sidebar.sidebar--collapsed .nav-item__badge,
.sidebar.sidebar--collapsed .sidebar__user-info,
.sidebar.sidebar--collapsed .sidebar__user > a span {
  opacity: 0;
  pointer-events: none;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--dur-fast) ease, max-width var(--dur-normal) var(--ease-out);
}

/* Logo centrado al colapsar */
.sidebar.sidebar--collapsed .sidebar__logo {
  padding: 0 0 var(--s-3);
  justify-content: center;
  width: 100%;
}
.sidebar.sidebar--collapsed .sidebar__logo-brand {
  justify-content: center;
  min-width: 0;
  gap: 0;
  width: 100%;
}
.sidebar.sidebar--collapsed .sidebar__logo-symbol {
  margin: 0 auto;
}

/* Usuario colapsado — ocultar avatar e info, centrar logout */
.sidebar.sidebar--collapsed .sidebar__user {
  padding: var(--s-2) 0;
  justify-content: center;
  gap: 0;
}
.sidebar.sidebar--collapsed .sidebar__user-avatar {
  display: none;
}
.sidebar.sidebar--collapsed .sidebar__logout-btn {
  margin: 0 auto;
}

/* Nav items colapsados — solo ícono centrado */
.sidebar.sidebar--collapsed .sidebar__nav {
  padding: var(--s-2) var(--s-1);
}
.sidebar.sidebar--collapsed .nav-item {
  justify-content: center;
  padding: var(--s-2) 0;
  margin: 1px var(--s-1);
  gap: 0;
  border-radius: var(--r-md);
  overflow: visible;
}
.sidebar.sidebar--collapsed .nav-item__icon {
  opacity: 0.8;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin: 0 auto;
}
.sidebar.sidebar--collapsed .nav-item:hover .nav-item__icon,
.sidebar.sidebar--collapsed .nav-item.active .nav-item__icon {
  opacity: 1;
}
.sidebar.sidebar--collapsed .nav-item.active {
  box-shadow: none;
  background: var(--c-primary-dim-hi);
}

/* ── Panel derecho (Chat + IA) ───────────────────────── */
.right-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(var(--right-panel-w), 92vw);
  background: var(--c-surface-1);
  border-left: 1px solid var(--c-border);
  z-index: 120;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-normal) var(--ease-out);
  box-shadow: -4px 0 24px rgba(0,0,0,.18);
}
.right-panel.open {
  transform: translateX(0);
}
.right-panel__header {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  min-height: var(--topbar-h);
}
.right-panel__tabs {
  display: flex; gap: var(--s-1); flex: 1;
}
.right-panel__tab {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-md);
  font-size: var(--t-xs); font-weight: 600;
  color: var(--c-text-2);
  cursor: pointer; background: none; border: none;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
  position: relative;
}
.right-panel__tab:hover { background: var(--c-surface-3); color: var(--c-text); }
.right-panel__tab.active {
  background: var(--c-primary-dim-hi);
  color: var(--c-primary-light);
}
.right-panel__tab-badge {
  background: var(--c-danger);
  color: #fff; font-size: var(--t-2xs); font-weight: 700;
  padding: 1px 5px; border-radius: var(--r-full);
  min-width: 16px; text-align: center;
}

/* ── Pestaña OKRs del perfil ────────────────────────── */
.okr-objective summary::-webkit-details-marker,
.okr-kr summary::-webkit-details-marker { display: none; }
.badge--okr-done { background: rgba(34,197,94,0.12); color: var(--c-success, #22c55e); }

.right-panel__close {
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--c-text-3); border-radius: var(--r-md);
  padding: var(--s-1); transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.right-panel__close:hover { background: var(--c-surface-3); color: var(--c-text); }
.right-panel__body { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

/* ── Botones de panel en topbar ──────────────────────── */
.topbar-panel-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.topbar-panel-btn__badge {
  position: absolute; top: 2px; right: 2px;
  width: 8px; height: 8px;
  background: var(--c-danger);
  border-radius: var(--r-full);
  border: 2px solid var(--c-surface-1);
  display: none;
}
.topbar-panel-btn__badge.visible { display: block; }

/* ── Chat UI dentro del panel ────────────────────────── */
.chat-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
}
.chat-sidebar {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--c-surface-1);
  transition: transform var(--dur-normal) var(--ease-out), opacity var(--dur-normal) ease;
  will-change: transform;
}
.chat-sidebar.hidden {
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}
.chat-sidebar__header {
  padding: var(--s-3) var(--s-4) var(--s-2);
  font-size: var(--t-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--c-text-3);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-channels { flex: 1; overflow-y: auto; }
.chat-channel-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  cursor: pointer;
  border-radius: 0;
  transition: background var(--dur-fast) ease;
  border-bottom: 1px solid var(--c-border-subtle);
  min-width: 0;
}
.chat-channel-item:hover { background: var(--c-surface-2); }
.chat-channel-item.active { background: var(--c-primary-dim); }
.chat-channel-item__icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--c-surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-xs); font-weight: 700;
  color: var(--c-text-2);
  flex-shrink: 0;
}
.chat-channel-item__info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.chat-channel-item__name {
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-channel-item__preview {
  font-size: var(--t-2xs);
  color: var(--c-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.chat-channel-item__badge {
  background: var(--c-danger);
  color: #fff;
  font-size: var(--t-2xs);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--r-full);
  min-width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Área de mensajes ────────────────────────────────── */
.chat-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--c-surface-1);
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--dur-normal) var(--ease-out), opacity var(--dur-normal) ease;
  will-change: transform;
}
.chat-view.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.chat-view__header {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: var(--s-2);
  flex-shrink: 0;
}
.chat-view__back {
  background: none; border: none; cursor: pointer;
  color: var(--c-text-2); padding: var(--s-1); border-radius: var(--r-md);
  display: flex; align-items: center;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.chat-view__back:hover { background: var(--c-surface-3); color: var(--c-text); }
.chat-view__name { font-size: var(--t-sm); font-weight: 700; flex: 1; }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.chat-msg {
  display: flex; gap: var(--s-2); align-items: flex-end;
  animation: msgIn .15s var(--ease-out);
}
.chat-msg--own { flex-direction: row-reverse; }
.chat-msg__avatar {
  width: 28px; height: 28px; border-radius: var(--r-full);
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-2xs); font-weight: 700; flex-shrink: 0;
  align-self: flex-end; margin-bottom: 4px; overflow: hidden;
}
.chat-msg__avatar--own {
  margin-left: var(--s-2);
}
.chat-msg__bubble {
  max-width: 78%;
  min-width: 0;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-lg);
  font-size: var(--t-sm);
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: var(--c-surface-3);
  color: var(--c-text);
}
.chat-msg--own .chat-msg__bubble {
  background: var(--c-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg:not(.chat-msg--own) .chat-msg__bubble {
  border-bottom-left-radius: 4px;
}
.chat-msg__meta {
  font-size: var(--t-2xs); color: var(--c-text-3);
  margin-top: 2px; padding: 0 var(--s-1);
  white-space: nowrap;
}
/* Links dentro de burbujas de chat — mismo color del texto para contraste garantizado
   sobre el fondo primario (mensaje propio) y sobre el fondo neutro (mensaje ajeno). */
.chat-msg__bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.chat-msg__bubble a:hover { opacity: .85; }
.chat-msg__read-receipt {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: var(--t-2xs);
  color: var(--c-text-3);
  padding: 0 var(--s-1);
  margin-top: 1px;
}
.chat-msg__read-receipt svg {
  flex-shrink: 0;
}
.chat-msg__read-receipt--seen {
  color: var(--c-primary);
}
.chat-msg__wrap {
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  flex: 1;
  min-width: 0;
  position: relative;
}
.chat-msg--own .chat-msg__wrap { flex-direction: row-reverse; }
/* Menú de acciones (editar / eliminar) */
.chat-msg__actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  align-self: flex-start;
  margin-top: 2px;
  transition: opacity var(--dur-fast) ease;
  flex-shrink: 0;
}
.chat-msg:hover .chat-msg__actions { opacity: 1; }
@media (hover: none) {
  .chat-msg__actions { opacity: 1; }
}
.chat-msg__action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-3);
  padding: 3px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.chat-msg__action-btn:hover { color: var(--c-primary); background: var(--c-primary-dim); }
.chat-msg__action-btn--del:hover { color: var(--c-danger); background: var(--c-danger-dim, rgba(244,63,94,.1)); }

/* Editor inline de mensaje */
.chat-msg__edit-wrap { display: flex; flex-direction: column; gap: var(--s-1); }
.chat-msg__edit-input {
  width: 100%;
  resize: none;
  border: 1px solid var(--c-primary);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-sm);
  font-family: inherit;
  background: var(--c-surface-2);
  color: var(--c-text-1);
  line-height: 1.4;
  outline: none;
  min-height: 36px;
}
.chat-msg__edit-actions { display: flex; gap: var(--s-2); justify-content: flex-end; }
.chat-msg__sender { font-weight: 600; color: var(--c-text-2); }
.chat-date-divider {
  text-align: center; font-size: var(--t-2xs); color: var(--c-text-3);
  padding: var(--s-2) 0; position: relative;
}
.chat-date-divider::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--c-border);
}
.chat-date-divider span {
  position: relative; background: var(--c-bg);
  padding: 0 var(--s-3);
}
/* Indicador "X está escribiendo…" */
.chat-typing-indicator {
  padding: 2px var(--s-4) 4px;
  font-size: var(--t-2xs);
  color: var(--c-text-3);
  font-style: italic;
  min-height: 18px;
  line-height: 18px;
}

/* Barra de "respondiendo a" en el footer */
.chat-reply-bar {
  display: none;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--c-surface-3);
  border-radius: var(--r-md);
  border-left: 3px solid var(--c-primary);
  font-size: var(--t-xs);
}
.chat-reply-bar__content { flex: 1; min-width: 0; }
.chat-reply-bar__sender  { font-weight: 600; color: var(--c-primary); font-size: var(--t-2xs); }
.chat-reply-bar__body    { color: var(--c-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Quote dentro de un mensaje (respuesta) — estilo WhatsApp */
.chat-msg__reply-quote {
  background: rgba(0,0,0,.18);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--r-sm);
  padding: 5px 10px 5px 8px;
  margin: -4px -4px 6px -4px;
  cursor: pointer;
  font-size: var(--t-xs);
  transition: background var(--dur-fast);
  min-width: 0;
  max-width: 100%;
}
.chat-msg__reply-quote:hover { background: rgba(0,0,0,.28); }
.chat-msg--own .chat-msg__reply-quote {
  background: rgba(0,0,0,.22);
  border-left-color: rgba(255,255,255,.6);
}
.chat-msg__reply-sender {
  font-weight: 700;
  color: var(--c-primary);
  font-size: var(--t-2xs);
  margin-bottom: 1px;
}
.chat-msg--own .chat-msg__reply-sender { color: rgba(255,255,255,.85); }
.chat-msg__reply-body {
  color: var(--c-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--t-xs);
  opacity: .85;
}
.chat-msg--own .chat-msg__reply-body { color: rgba(255,255,255,.75); }

/* Reacciones con emoji */
.chat-msg__reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  padding: 0 var(--s-1);
}
.chat-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.chat-reaction:hover { background: var(--c-primary-dim); border-color: var(--c-primary); }
.chat-reaction--mine { background: var(--c-primary-dim); border-color: var(--c-primary); }
.chat-reaction span  { font-size: var(--t-2xs); color: var(--c-text-2); }

/* Emoji picker flotante */
.chat-emoji-picker {
  position: fixed;
  z-index: 9999;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-2);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  max-width: 200px;
}
.chat-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: var(--r-sm);
  line-height: 1;
  transition: background var(--dur-fast) ease;
}
.chat-emoji-btn:hover { background: var(--c-surface-3); }

.chat-footer {
  padding: var(--s-3) var(--s-3) var(--s-3);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex-shrink: 0;
  background: var(--c-surface-1);
}
.chat-footer__row {
  display: flex;
  gap: var(--s-2);
  align-items: flex-end;
}
.chat-footer__input {
  flex: 1;
  min-width: 0;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  padding: var(--s-2) var(--s-3);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  color: var(--c-text);
  font-size: var(--t-sm);
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  box-sizing: border-box;
  width: 100%;
  overflow-y: auto;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.chat-footer__input:focus {
  border-color: var(--c-primary);
  background: var(--c-surface-3);
}
.chat-footer__input::placeholder {
  color: var(--c-text-3);
  font-size: var(--t-sm);
}

/* ── IA embebida en panel derecho ────────────────────── */
.panel-ia {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .right-panel {
    width: 100vw;
    top: 0;
    bottom: 0;
    border-left: none;
    border-radius: 0;
  }
  .app-shell.panel-open {
    padding-right: 0;
  }
  .chat-footer {
    padding-bottom: max(var(--s-3), env(safe-area-inset-bottom));
  }
  /* font-size >= 16px evita el zoom automático de iOS Safari al enfocar el input */
  .chat-footer__input,
  .chat-footer__input::placeholder,
  .maria-input {
    font-size: 16px;
  }
}

/* ─── Main content ───────────────────────────────────── */
.main {
  grid-area: main;
  padding: var(--s-6);
  overflow-y: auto;
  overflow-x: auto;
  min-width: 0;
}

/* ─── Page header ────────────────────────────────────── */
.page-header {
  display: flex; flex-direction: column;
  margin-bottom: var(--s-6);
  gap: var(--s-3);
}
.page-header__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
}
.page-header__heading {
  font-size: var(--t-2xl);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.page-header__sub {
  color: var(--c-text-3);
  font-size: var(--t-sm);
  margin-top: var(--s-1);
}
.page-header__actions {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; flex-shrink: 0;
}

/* ─── Botones ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  font-weight: 600;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-normal) var(--ease-out),
    background var(--dur-fast) ease,
    opacity var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
  white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn:active { transform: scale(0.96) !important; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff;
  box-shadow: 0 2px 12px rgba(124,106,247,0.3);
}
.btn--primary:hover {
  box-shadow: 0 4px 20px rgba(124,106,247,0.5);
  transform: translateY(-1px);
}

.btn--accent {
  background: linear-gradient(135deg, var(--c-accent), #04b07a);
  color: var(--c-text-inv);
  box-shadow: 0 2px 12px rgba(6,214,160,0.3);
}
.btn--accent:hover { box-shadow: 0 4px 20px rgba(6,214,160,0.45); transform: translateY(-1px); }

.btn--ghost {
  background: transparent;
  color: var(--c-text-2);
  border: 1px solid var(--c-border);
}
.btn--ghost:hover { background: var(--c-surface-3); color: var(--c-text); border-color: var(--c-border-hi); }

.btn--danger {
  background: linear-gradient(135deg, var(--c-danger), #c9183a);
  color: #fff;
  box-shadow: 0 2px 12px rgba(244,63,94,0.3);
}
.btn--danger:hover { box-shadow: 0 4px 20px rgba(244,63,94,0.45); transform: translateY(-1px); }

.btn--ghost-danger {
  background: transparent;
  color: var(--c-danger);
  border: 1px solid rgba(244,63,94,0.3);
}
.btn--ghost-danger:hover { background: var(--c-danger-dim); border-color: var(--c-danger); }

.btn--sm  { padding: var(--s-1) var(--s-3); font-size: var(--t-xs); }
.btn--xs  { padding: 3px var(--s-2); font-size: var(--t-2xs); }
.btn--lg  { padding: var(--s-3) var(--s-6); font-size: var(--t-base); }
.btn--icon { padding: var(--s-2); width: 34px; height: 34px; justify-content: center; }
.btn--icon-sm { padding: var(--s-1); width: 28px; height: 28px; justify-content: center; }
.btn--full { width: 100%; justify-content: center; }

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--dur-normal) ease, box-shadow var(--dur-normal) ease;
}
.card:hover { border-color: var(--c-border-hi); }
.card--glass {
  background: var(--c-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ─── Kanban Board ───────────────────────────────────── */
.kanban {
  display: grid;
  /* auto-fill (no repeat(5,...) fijo): un proyecto con más de 5 columnas generaba tracks
     implícitos de ancho "auto" para la 6ª en adelante, rompiendo el ancho uniforme del resto. */
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-auto-columns: minmax(250px, 1fr);
  grid-auto-flow: column;
  gap: var(--s-4);
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: var(--s-6);
  min-height: 0;
  /* altura máxima del grid = viewport menos cabecera — hace que todas las cols sean iguales */
  max-height: calc(100vh - 190px);
}
/* Base compartida con .ct-col (Core Team) — declaraciones comunes consolidadas aquí,
   cada selector agrega solo lo que le es propio (height/max-height). */
.kanban-col,
.ct-col {
  background: var(--c-surface-1);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  min-height: 300px;
  display: flex; flex-direction: column;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.kanban-col {
  height: 100%;
  max-height: calc(100vh - 190px);
}
.kanban-col--hidden-indicator {
  border-style: dashed;
  border-color: var(--c-border);
  background: transparent;
  min-width: 140px;
  max-width: 180px;
  height: auto;
  min-height: 120px;
  transition: border-color var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.kanban-col--hidden-indicator:hover {
  border-color: var(--c-accent);
  opacity: 1 !important;
}
.kanban-col__header {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-3);
  flex-shrink: 0;
}
.kanban-col__dot {
  width: 8px; height: 8px; border-radius: var(--r-full); flex-shrink: 0;
}
.kanban-col__label {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-text-2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kanban-col__label--editable {
  cursor: pointer;
  border-radius: var(--r-xs);
  padding: 1px 3px;
  transition: background var(--dur-fast);
}
.kanban-col__label--editable:hover {
  background: var(--c-surface-3);
  color: var(--c-text-1);
}
.kanban-col__rename-input {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  flex: 1;
}
.kanban-col__menu-btn {
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.kanban-col__header:hover .kanban-col__menu-btn { opacity: 1; }
@media (hover: none) {
  .kanban-col__menu-btn { opacity: 1; }
}
.col-menu-item {
  display: flex; align-items: center; gap: var(--s-2);
  width: 100%; padding: var(--s-2) var(--s-3);
  font-size: var(--t-sm); color: var(--c-text-1);
  background: none; border: none; cursor: pointer;
  transition: background var(--dur-fast);
}
.col-menu-item:hover { background: var(--c-surface-3); }
.col-menu-item--danger { color: var(--c-danger); }
.col-menu-item--danger:hover { background: var(--c-danger-dim); }
.col-color-swatch:hover { transform: scale(1.15); }
.col-color-swatch.selected { border-color: var(--c-text-1) !important; }
.kanban-col__count {
  margin-left: auto;
  font-size: var(--t-2xs);
  color: var(--c-text-3);
  background: var(--c-surface-3);
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-weight: 600;
}
.kanban-col__add {
  margin-top: var(--s-2);
  width: 100%;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  background: transparent;
  border: 1px dashed var(--c-border);
  color: var(--c-text-3);
  font-size: var(--t-xs);
  display: flex; align-items: center; gap: var(--s-2);
  cursor: pointer;
  transition: all var(--dur-fast) ease;
  flex-shrink: 0;
}
.kanban-col__add:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-dim); }
.kanban-col__body {
  display: flex; flex-direction: column; gap: var(--s-2);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}
.kanban-col__body::-webkit-scrollbar { width: 4px; }
.kanban-col__body::-webkit-scrollbar-track { background: transparent; }
.kanban-col__body::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: var(--r-full); }

/* ─── Task Card ──────────────────────────────────────── */
.task-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  cursor: grab;
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-normal) ease,
    border-color var(--dur-normal) ease,
    background var(--dur-fast) ease;
}
.task-card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--shadow-md);
  border-color: var(--c-border-hi);
  background: var(--c-surface-3);
}
.task-card:active { cursor: grabbing; }
.task-card.dragging {
  opacity: 0.35;
  transform: scale(0.97) rotate(1deg);
  box-shadow: var(--shadow-xl);
}
.task-card--moving {
  animation: cardDrop 280ms var(--ease-spring) both;
}
@keyframes cardDrop {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}
.task-card__accent {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}
.task-card__title {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text);
  margin-bottom: var(--s-2);
  line-height: 1.45;
  padding-left: var(--s-3);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.task-card__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2);
  padding-left: var(--s-3);
}
.task-card__last-comment {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  font-style: italic;
  margin-top: var(--s-2);
  padding-left: var(--s-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.task-card__actions {
  position: absolute; top: var(--s-2); right: var(--s-2);
  display: none;
  gap: 2px;
}
.task-card:hover .task-card__actions { display: flex; }
@media (hover: none) {
  .task-card__actions { display: flex; }
}
.task-card__approval-row {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  padding-left: var(--s-3);
  margin-top: var(--s-2);
}
.task-card__approval-row .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge--priority-low      { background: var(--c-success-dim);  color: var(--pri-low); }
.badge--priority-medium   { background: var(--c-info-dim);     color: var(--pri-medium); }
.badge--priority-high     { background: var(--c-warning-dim);  color: var(--pri-high); }
.badge--priority-critical {
  background: var(--c-danger-dim);
  color: var(--pri-critical);
  animation: pulse-badge 2s ease infinite;
}
.badge--sprint          { background: var(--c-primary-dim);  color: var(--c-primary);  border: 1px solid var(--c-border-glow); }
.badge--sprint-planned  { background: var(--c-surface-4);    color: var(--c-text-3);   border: 1px solid var(--c-border); }
.badge--sprint-active   { background: rgba(34,197,94,0.12);  color: #16a34a;            border: 1px solid rgba(34,197,94,0.25); }
.badge--sprint-completed{ background: rgba(99,102,241,0.12); color: var(--c-primary);  border: 1px solid var(--c-border-glow); }
.badge--subtasks      { background: var(--c-surface-4); color: var(--c-text-2); border: 1px solid var(--c-border); display:inline-flex;align-items:center;gap:3px; }
.badge--subtasks-done { background: rgba(34,197,94,0.10); color: #16a34a; border-color: rgba(34,197,94,0.25); }
.badge--recurrence { background: var(--c-accent-dim); color: var(--c-accent); }
.badge--overdue    { background: var(--c-danger-dim); color: var(--pri-critical); }
.badge--parent     { background: rgba(59,130,246,0.10); color: #2563eb; border: 1px solid rgba(59,130,246,0.25); display:inline-flex;align-items:center;gap:3px; }
.badge--issue      { background: rgba(239,68,68,0.12); color: #dc2626; border: 1px solid rgba(239,68,68,0.28); display:inline-flex;align-items:center;gap:3px; }
.badge--test-matrix{ background: rgba(16,185,129,0.10); color: #059669; border: 1px solid rgba(16,185,129,0.25); display:inline-flex;align-items:center;gap:3px; }
/* .badge--sc-pending (Scope Changes) reutiliza esta misma paleta — eran declaraciones
   idénticas duplicadas, consolidadas en un solo selector (auditoría 2026-07-14). */
.badge--pending-approval,
.badge--sc-pending { background: rgba(245,158,11,0.12); color: #b45309; border: 1px solid rgba(245,158,11,0.28); display:inline-flex;align-items:center;gap:3px; }
.badge--okr-link { background: rgba(124,106,247,0.18); color: #a78bfa; border: 1px solid rgba(124,106,247,0.35); display:inline-flex;align-items:center;gap:3px; }
.kanban-col__header--issue { border-bottom: 2px solid rgba(245,158,11,0.35); }

/* ── Go Live / Hypercare chips ──────────────────────────── */
.go-live-chips { display:flex;flex-wrap:wrap;gap:var(--s-2);margin-top:var(--s-2); }
.chip { display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:var(--r-full);font-size:var(--t-xs);font-weight:500;border:1px solid transparent;white-space:nowrap; }
.chip--go-live-upcoming { background:rgba(99,102,241,0.10);color:#4f46e5;border-color:rgba(99,102,241,0.25); }
.chip--go-live-today    { background:rgba(16,185,129,0.12);color:#059669;border-color:rgba(16,185,129,0.30); }
.chip--go-live-past     { background:rgba(107,114,128,0.10);color:#6b7280;border-color:rgba(107,114,128,0.25); }
.chip--hypercare        { background:rgba(245,158,11,0.10);color:#b45309;border-color:rgba(245,158,11,0.28); }

/* ── Metodología AllRounder — timeline de 4 fases ─────────── */
.methodology-timeline { display:flex; align-items:center; gap:0; flex-wrap:wrap; }
.methodology-step { display:flex; align-items:center; gap:var(--s-2); flex:1; min-width:140px; position:relative; }
.methodology-step:not(:last-child)::after {
  content:''; position:absolute; top:9px; left:calc(100% - 4px); width:calc(var(--s-3) + 8px); height:2px;
  background:var(--c-border-subtle);
}
.methodology-step__dot {
  width:18px; height:18px; border-radius:50%; flex-shrink:0; display:flex; align-items:center; justify-content:center;
  background:var(--c-surface-3); color:transparent; border:2px solid var(--c-border-subtle);
}
.methodology-step__label { font-size:var(--t-xs); color:var(--c-text-3); }
.methodology-step--done .methodology-step__dot { background:#10b981; border-color:#10b981; color:#fff; }
.methodology-step--done .methodology-step__label { color:var(--c-text-2); }
.methodology-step--active .methodology-step__dot { border-color:#7c6af7; background:rgba(124,106,247,0.15); }
.methodology-step--active .methodology-step__label { color:#7c6af7; font-weight:600; }

/* ── Scope Changes ──────────────────────────────────────── */
/* .badge--sc-pending: ver .badge--pending-approval (consolidado, misma paleta) */
.badge--sc-approved { background:rgba(16,185,129,0.12); color:#059669; border:1px solid rgba(16,185,129,0.28); }
.badge--sc-rejected { background:rgba(239,68,68,0.10);  color:#dc2626; border:1px solid rgba(239,68,68,0.25); }
.scope-change-card { border:1px solid var(--c-border-subtle);border-radius:var(--r-md);padding:var(--s-4);margin-bottom:var(--s-3); }
.scope-change-card:last-child { margin-bottom:0; }
.scope-change-card__header { display:flex;align-items:center;gap:var(--s-2);margin-bottom:var(--s-2); }
.scope-change-card__title { font-size:var(--t-sm);font-weight:600;color:var(--c-text-1);flex:1; }
.scope-change-card__meta { font-size:var(--t-xs);color:var(--c-text-3);margin-bottom:var(--s-2); }
.scope-change-card__body { font-size:var(--t-sm);color:var(--c-text-2);margin:var(--s-2) 0; }
.scope-change-card__impact { font-size:var(--t-sm);color:var(--c-text-2);margin:var(--s-2) 0; }
.scope-change-card__review-note { font-size:var(--t-sm);color:var(--c-text-2);margin:var(--s-2) 0;padding:var(--s-2) var(--s-3);background:var(--c-surface-2);border-radius:var(--r-sm); }
.scope-change-card__tasks { display:flex;flex-wrap:wrap;gap:var(--s-2);margin:var(--s-2) 0; }
.scope-change-card__task-chip { display:inline-flex;align-items:center;gap:4px;padding:2px 8px;background:var(--c-surface-3);border:1px solid var(--c-border-subtle);border-radius:var(--r-full);font-size:var(--t-xs);color:var(--c-text-2);max-width:100%; }
.scope-change-card__actions { display:flex;gap:var(--s-2);margin-top:var(--s-3);flex-wrap:wrap; }
.scope-changes-scroll { max-height:320px;overflow-y:auto;padding-right:var(--s-1); }
.btn--success { background:var(--c-success);color:#fff;border-color:var(--c-success); }
.btn--success:hover { filter:brightness(0.9); }
/* Nota: .btn--danger ya definido en la sección de botones globales */
.badge--success    { background: var(--c-success-dim); color: var(--c-success); }
.badge--danger     { background: var(--c-danger-dim);  color: var(--c-danger); }
.badge--warning    { background: var(--c-warning-dim); color: var(--c-warning); }
.badge--info       { background: var(--c-info-dim);    color: var(--c-info); }
.badge--muted      { background: var(--c-surface-4);   color: var(--c-text-3); }
.badge--status-backlog   { background: rgba(75,83,113,0.2);  color: var(--col-backlog); }
.badge--status-todo      { background: rgba(59,130,246,0.15); color: var(--col-todo); }
.badge--status-progress  { background: rgba(168,85,247,0.15); color: var(--col-progress); }
.badge--status-review    { background: var(--c-warning-dim);  color: var(--col-review); }
.badge--status-done      { background: var(--c-success-dim);  color: var(--col-done); }

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,63,94,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(244,63,94,0); }
}

/* ─── Avatar ─────────────────────────────────────────── */
.avatar {
  width: 26px; height: 26px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--t-2xs); font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm  { width: 22px;  height: 22px;  font-size: var(--t-2xs); }
.avatar--md  { width: 34px;  height: 34px;  font-size: 13px; }
.avatar--lg  { width: 42px;  height: 42px;  font-size: 16px; }
.avatar--xl  { width: 56px;  height: 56px;  font-size: 20px; }
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -7px; border: 2px solid var(--c-surface-2); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ─── Due date chip ──────────────────────────────────── */
.due-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.due-chip.overdue { color: var(--c-danger); font-weight: 600; }
.due-chip.soon    { color: var(--c-warning); }

/* ─── Formularios ────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field label {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-text-2);
}
.input, .select, .textarea {
  background: var(--c-surface-3);
  border: 1px solid var(--c-border-hi);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  color: var(--c-text);
  font-size: var(--t-sm);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-dim);
}
.input::placeholder, .textarea::placeholder { color: var(--c-text-3); }
.select { appearance: none; cursor: pointer; }
.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '';
  position: absolute; right: var(--s-3); top: 50%; transform: translateY(-50%);
  border: 4px solid transparent;
  border-top-color: var(--c-text-3);
  margin-top: 2px;
  pointer-events: none;
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.field__error { font-size: var(--t-xs); color: var(--c-danger); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.field__hint  { font-size: var(--t-xs); color: var(--c-text-3); margin-top: 3px; display: block; line-height: 1.4; }
.field--full  { grid-column: 1 / -1; }
.field .label { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--c-text-2); }
.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
@media (max-width: 480px) { .field-grid-2 { grid-template-columns: 1fr; } }

/* ─── Acceso a módulos + tipo de usuario por módulo (modal crear/editar usuario) ── */
.module-access-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
@media (max-width: 480px) { .module-access-grid { grid-template-columns: 1fr; } }
.module-access-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3);
}
.input--sm, .select--sm { padding: var(--s-1) var(--s-3); font-size: var(--t-xs); border-radius: var(--r-sm); }

/* Mention autocomplete */
.mention-list {
  position: absolute; z-index: 100;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-hi);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  min-width: 220px; max-height: 220px;
  overflow-y: auto;
  padding: var(--s-1);
}
.mention-item {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: var(--t-sm);
  transition: background var(--dur-fast) ease;
}
.mention-item:hover, .mention-item.selected { background: var(--c-primary-dim-hi); }

/* ─── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5,6,11,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-normal) ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-hi);
  border-radius: var(--r-2xl);
  width: 100%; max-width: 640px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(24px) scale(0.96);
  transition: transform var(--dur-normal) var(--ease-out);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal--sm  { max-width: 440px; }
.modal--lg  { max-width: 780px; }
.modal--xl  { max-width: 960px; }
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0;
  background: var(--c-surface-2);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  z-index: 1;
}
.modal__title {
  font-size: var(--t-lg);
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.modal__body  { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); }
.modal__footer {
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--c-border);
  display: flex; justify-content: flex-end; gap: var(--s-3);
  background: var(--c-surface-2);
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  position: sticky; bottom: 0; z-index: 1; flex-shrink: 0;
}

/* ─── Drawer ─────────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(5,6,11,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-normal) ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 160;
  width: 500px; max-width: 96vw;
  background: var(--c-surface-1);
  border-left: 1px solid var(--c-border-hi);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-normal) var(--ease-out);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
.drawer-overlay.open + .drawer { transform: translateX(0); }
.drawer__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5) var(--s-3);
  flex-shrink: 0;
  gap: var(--s-3);
}
.drawer__header-actions { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.drawer__header-badges {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-5) var(--s-3);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.drawer__approval-row {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--c-border);
  background: rgba(245,158,11,0.06);
  flex-shrink: 0;
}
.drawer__approval-row .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }
@media (max-width: 480px) { .drawer__approval-row { flex-direction: column; } }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-5); }
.drawer__section-title {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin-bottom: var(--s-3);
  display: flex; align-items: center; gap: var(--s-2);
}
.drawer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
.drawer__meta-item {}
.drawer__meta-value { font-size: var(--t-sm); color: var(--c-text); margin-top: var(--s-1); }

/* ─── Comentarios ────────────────────────────────────── */
.comment {
  display: flex; gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-border);
}
.comment:last-child { border-bottom: none; }
.comment__body { flex: 1; }
.comment__author { font-size: var(--t-xs); font-weight: 600; color: var(--c-text-2); }
.comment__date   { font-size: var(--t-xs); color: var(--c-text-3); margin-left: var(--s-2); }
.comment__text   { font-size: var(--t-sm); color: var(--c-text); margin-top: 3px; line-height: 1.55; word-break: break-word; overflow-wrap: anywhere; }
.comment__text a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.comment__text a:hover { opacity: .85; }

/* Chip de mención (@nombre) — global, funciona en cualquier contenedor de comentarios */
.mention {
  display: inline-block;
  background: var(--c-primary-dim);
  color: var(--c-primary-light);
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.comment-box   { position: relative; }
.comment-input-row { display: flex; align-items: flex-end; gap: var(--s-2); }

/* ─── Tabla reporte ──────────────────────────────────── */
.report-table { width: 100%; border-collapse: collapse; }
.report-table th {
  font-size: var(--t-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--c-text-3);
  padding: var(--s-2) var(--s-3); text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.report-table td {
  padding: var(--s-3);
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-sm);
  vertical-align: middle;
}
.report-table tr:hover td { background: var(--c-surface-3); }
.report-table .project-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: var(--r-full); margin-right: 6px;
  vertical-align: middle;
}

/* ─── Stats cards ────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.stat-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: relative; overflow: hidden;
  transition: border-color var(--dur-normal) ease, transform var(--dur-fast) var(--ease-out);
}
.stat-card:hover { border-color: var(--c-border-hi); transform: translateY(-2px); }
.stat-card::after {
  content: '';
  position: absolute; right: -12px; bottom: -12px;
  width: 80px; height: 80px; border-radius: var(--r-full);
  background: var(--c-primary-dim);
  pointer-events: none;
}
.stat-card__icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--c-primary-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-primary-light);
  margin-bottom: var(--s-3);
}
.stat-card__label { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--c-text-3); margin-bottom: var(--s-1); }
.stat-card__value { font-size: var(--t-3xl); font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.stat-card__sub   { font-size: var(--t-xs); color: var(--c-text-2); margin-top: var(--s-1); }
.stat-card__trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--t-xs); font-weight: 600;
  margin-top: var(--s-1);
}
.stat-card__trend--up   { color: var(--c-success); }
.stat-card__trend--down { color: var(--c-danger); }

/* ─── Mis Tareas ─────────────────────────────────────── */
.my-tasks-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.my-tasks-filters__field {
  flex: 1 1 220px;
  max-width: 320px;
}
@media (max-width: 640px) {
  .my-tasks-filters__field { max-width: none; }
}

.my-task-kpi { cursor: pointer; user-select: none; }
.my-task-kpi--selected { border-color: var(--c-primary); box-shadow: 0 0 0 1px var(--c-primary); }

.my-task-group__header {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) 0; margin-bottom: var(--s-2);
}

.my-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
}

.my-task-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  cursor: pointer;
  transition: border-color var(--dur-normal) ease, transform var(--dur-fast) var(--ease-out);
}
.my-task-card:hover { border-color: var(--c-border-hi); transform: translateY(-2px); }
.my-task-card__top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.my-task-card__title { font-weight: 600; font-size: var(--t-sm); line-height: 1.35; }
.my-task-card__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2);
  font-size: var(--t-xs);
}

/* ─── Filtros ────────────────────────────────────────── */
.filters {
  display: flex; align-items: center; gap: var(--s-2);
  flex-wrap: wrap; margin-bottom: var(--s-5);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  font-size: var(--t-xs); font-weight: 600;
  color: var(--c-text-2); cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.filter-chip:hover    { border-color: var(--c-border-hi); color: var(--c-text); background: var(--c-surface-4); }
.filter-chip.selected { background: var(--c-primary-dim-hi); border-color: var(--c-primary); color: var(--c-primary-light); }
.filter-chip--dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: var(--r-full);
  background: var(--dot-color, currentColor);
  display: inline-block;
}

/* ─── Portfolio filters ──────────────────────────────── */
.portfolio-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.portfolio-filters .select-wrapper { min-width: 180px; }
.portfolio-filters .select { width: 100%; }

/* ─── Badges de tipo de proyecto ─────────────────────── */
.project-type-badge {
  font-size: var(--t-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.project-type-badge--external {
  background: color-mix(in srgb, var(--c-primary) 15%, transparent);
  color: var(--c-primary);
}
.project-type-badge--internal {
  background: color-mix(in srgb, var(--c-success) 15%, transparent);
  color: var(--c-success);
}

/* ─── Proyectos grid ─────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}
.project-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  cursor: pointer;
  position: relative; overflow: hidden;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-normal) ease,
    border-color var(--dur-normal) ease;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--c-border-hi);
}
.project-card__stripe {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.project-card__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--s-3);
}
.project-card__client { font-size: var(--t-xs); color: var(--c-text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--s-1); }
.project-card__name   { font-size: var(--t-lg); font-weight: 700; line-height: 1.3; }
.project-card__desc   { font-size: var(--t-xs); color: var(--c-text-3); margin-bottom: var(--s-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card__footer { display: flex; align-items: center; gap: var(--s-2); }
.project-card__progress { height: 4px; background: var(--c-surface-3); border-radius: var(--r-full); flex: 1; overflow: hidden; }
.project-card__progress-fill { height: 100%; border-radius: var(--r-full); transition: width 0.6s var(--ease-out); }
.project-card__actions {
  position: absolute; top: var(--s-3); right: var(--s-3);
  display: none; gap: 2px;
}
.project-card:hover .project-card__actions { display: flex; }
@media (hover: none) {
  .project-card__actions { display: flex; }
}

/* ─── Gestión de la demanda (AllRounder) ─────────────── */
.demand-list {
  display: flex; flex-direction: column; gap: var(--s-3);
}
.demand-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: relative; overflow: hidden;
  transition: border-color var(--dur-normal) ease, box-shadow var(--dur-normal) ease;
}
.demand-card:hover { border-color: var(--c-border-hi); box-shadow: var(--shadow-md); }
.demand-card__stripe { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.demand-card__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4);
}
.demand-card__title-row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; min-width: 0; }
.demand-card__name { font-size: var(--t-lg); font-weight: 700; line-height: 1.3; }
.demand-card__client { color: var(--c-text-2); font-size: var(--t-sm); margin-top: var(--s-1); }
.demand-card__meta { color: var(--c-text-3); font-size: var(--t-xs); margin-top: 2px; }
.demand-card__actions { display: flex; gap: var(--s-2); flex-shrink: 0; flex-wrap: wrap; }

/* Stepper de fase (9 pasos secuenciales del flujo AllRounder) */
.demand-stepper {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: var(--s-2);
}
.demand-stepper__dot {
  flex: 1; height: 4px; border-radius: var(--r-full);
  background: var(--c-surface-4);
}
.demand-stepper__dot--done   { background: var(--c-success); }
.demand-stepper__dot--current{ background: var(--c-primary); }
.demand-stepper__dot--rejected{ background: var(--c-danger); }
.demand-stepper__label {
  font-size: var(--t-xs); color: var(--c-text-3);
  white-space: nowrap; margin-left: var(--s-2);
}

/* Historial de fases (modal de detalle) */
.demand-history { display: flex; flex-direction: column; gap: 0; }
.demand-history__item {
  display: flex; gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-border-subtle);
}
.demand-history__item:last-child { border-bottom: none; }
.demand-history__dot {
  width: 8px; height: 8px; border-radius: var(--r-full);
  background: var(--c-primary); margin-top: 6px; flex-shrink: 0;
}
.demand-history__body { min-width: 0; }
.demand-history__state { font-size: var(--t-sm); font-weight: 600; }
.demand-history__meta { font-size: var(--t-xs); color: var(--c-text-3); margin-top: 2px; }
.demand-history__reason { font-size: var(--t-sm); color: var(--c-text-2); margin-top: var(--s-1); }

/* Checklist de entregables RE-0X (modal "Avanzar de fase") */
.demand-deliverables { display: flex; flex-direction: column; gap: var(--s-3); }
.demand-deliverable {
  padding: var(--s-3);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
}
.demand-deliverable__row {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
}
.demand-deliverable__row .input { flex: 1; min-width: 200px; }

@media (max-width: 768px) {
  .demand-card__actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 480px) {
  .demand-card { padding: var(--s-4); }
  .demand-card__actions .btn { flex: 1; }
}

/* ─── Team — barra de filtros ────────────────────────── */
.team-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-6);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
}
.team-toolbar__search {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 0 var(--s-3);
  transition: border-color var(--dur-fast);
}
.team-toolbar__search:focus-within { border-color: var(--c-primary); }
.team-toolbar__search svg { color: var(--c-text-4); flex-shrink: 0; }
.team-toolbar__search input {
  background: none;
  border: none;
  outline: none;
  color: var(--c-text-1);
  font-size: var(--t-sm);
  padding: var(--s-2) 0;
  width: 100%;
}
.team-toolbar__search input::placeholder { color: var(--c-text-4); }
.team-filter-group {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  flex-wrap: wrap;
}
.team-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: .25rem .75rem;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-surface-3);
  color: var(--c-text-3);
  font-size: var(--t-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast);
  white-space: nowrap;
}
.team-filter-chip:hover { border-color: var(--c-border-hi); color: var(--c-text-1); }
.team-filter-chip.active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}
.team-view-toggle {
  display: flex;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.team-view-btn {
  background: none;
  border: none;
  padding: var(--s-2) var(--s-3);
  color: var(--c-text-3);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  display: flex;
  align-items: center;
}
.team-view-btn:hover { background: var(--c-surface-3); color: var(--c-text-1); }
.team-view-btn.active { background: var(--c-surface-3); color: var(--c-primary); }

/* ─── Team grid / list ───────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}
.team-section-label {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  margin-top: var(--s-2);
}
.team-section-label h3 {
  font-size: var(--t-base);
  font-weight: 700;
}

/* ─── Member card (grid) ─────────────────────────────── */
.member-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-4) var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: border-color var(--dur-normal) ease, box-shadow var(--dur-fast);
  position: relative;
}
.member-card:hover {
  border-color: var(--c-border-hi);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.member-card__top { display: flex; align-items: flex-start; gap: var(--s-3); min-width: 0; }
.member-card__info { flex: 1; min-width: 0; }
.member-card__name {
  font-weight: 700;
  font-size: var(--t-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.member-card__email {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--s-2);
}
.member-card__status { display: flex; align-items: center; gap: var(--s-2); }
.member-card__actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-border-subtle);
  margin-top: auto;
}
.member-card__main-btn { width: 100%; justify-content: center; font-size: var(--t-xs); gap: 5px; }
.member-card__icon-row { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-1); }
.member-card--inactive { opacity: .5; }
.member-card__role-badge { margin-top: 2px; }

/* ─── Member row (list view) ─────────────────────────── */
.team-list { display: flex; flex-direction: column; gap: var(--s-2); }
.member-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.member-row:hover { border-color: var(--c-border-hi); background: var(--c-surface-3); }
.member-row__info { min-width: 0; }
.member-row__name { font-weight: 600; font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-row__email { font-size: var(--t-xs); color: var(--c-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-row__actions { display: flex; align-items: center; gap: var(--s-1); }
.member-row--inactive { opacity: .5; }
.member-role-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 160px; }
@media (max-width: 640px) {
  .member-role-chips { justify-content: flex-start; max-width: none; }
}

/* ─── empty state filtrado ───────────────────────────── */
.team-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: var(--s-12) var(--s-6);
  color: var(--c-text-3);
  font-size: var(--t-sm);
}

/* ─── Login ──────────────────────────────────────────── */
/* ══════════════════════════════════════════════════════
   LOGIN — Layout split (brand | form)
   ══════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--c-bg);
  position: relative; overflow: hidden;
}

/* Panel izquierdo — branding */
.login-brand {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--s-12) var(--s-10);
  overflow: hidden;
  background: var(--c-surface-1);
}
.login-brand::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(124,106,247,0.25) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 75%, rgba(6,214,160,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.login-brand::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(124,106,247,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.5;
}
.login-brand__inner {
  position: relative; z-index: 1;
  text-align: center;
  max-width: 400px;
}
.login-brand__symbol {
  width: 96px; height: 96px;
  margin: 0 auto var(--s-6);
  background: rgba(124,106,247,0.12);
  border-radius: var(--r-2xl);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(124,106,247,0.25);
  box-shadow: 0 0 48px rgba(124,106,247,0.2), 0 0 0 1px rgba(255,255,255,0.04) inset;
  animation: loginPulse 4s ease-in-out infinite;
}
.login-brand__symbol img {
  width: 60px; height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(124,106,247,0.5));
}
@keyframes loginPulse {
  0%, 100% { box-shadow: 0 0 48px rgba(124,106,247,0.2), 0 0 0 1px rgba(255,255,255,0.04) inset; }
  50%       { box-shadow: 0 0 72px rgba(124,106,247,0.35), 0 0 0 1px rgba(255,255,255,0.08) inset; }
}
.login-brand__name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #7c6af7 0%, #06d6a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--s-2);
}
.login-brand__tagline {
  font-size: var(--t-base);
  color: var(--c-text-2);
  line-height: 1.6;
  margin-bottom: var(--s-8);
}
.login-brand__pills {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  justify-content: center;
}
.login-brand__pill {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 3px var(--s-3);
  letter-spacing: 0.02em;
}
.login-brand__footer {
  position: absolute; bottom: var(--s-6);
  font-size: var(--t-2xs);
  color: var(--c-text-4, var(--c-text-3));
}
[data-theme="light"] .login-brand {
  background: color-mix(in srgb, var(--c-primary) 4%, white);
}

/* Panel derecho — formulario */
.login-form-panel {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--s-10) var(--s-8);
  position: relative;
}
.login-form-panel__theme {
  position: absolute; top: var(--s-5); right: var(--s-5);
}
.login-box {
  width: 100%; max-width: 400px;
}
.login-box__logo { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-8); }
.login-box__logo-img { width: 36px; height: 36px; object-fit: contain; }
.login-box__logo-texts { display: flex; flex-direction: column; gap: 1px; }
.login-box__logo-name { font-size: var(--t-base); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.login-box__logo-sub { font-size: var(--t-2xs); color: var(--c-text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.login-box__title { font-size: var(--t-2xl); font-weight: 800; margin-bottom: var(--s-2); letter-spacing: -0.02em; }
.login-box__sub   { font-size: var(--t-sm); color: var(--c-text-2); margin-bottom: var(--s-8); }
.login-box__divider { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0; color: var(--c-text-3); font-size: var(--t-xs); }
.login-box__divider::before, .login-box__divider::after { content: ''; flex: 1; height: 1px; background: var(--c-border); }

/* Mobile — colapsa a 1 columna, oculta brand panel */
@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; background: var(--c-bg); }
  .login-brand { display: none; }
  .login-form-panel { padding: var(--s-8) var(--s-5); min-height: 100vh; }
}

/* ─── Toast ──────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: var(--s-5); right: var(--s-5); z-index: 999;
  display: flex; flex-direction: column; gap: var(--s-2);
  pointer-events: none;
}
.toast {
  background: var(--c-glass-hi);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--c-border-hi);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-sm);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: var(--s-3);
  min-width: 260px; max-width: 380px;
  animation: slideInToast var(--dur-normal) var(--ease-out) both;
  pointer-events: all;
}
.toast.success { border-left: 3px solid var(--c-success); }
.toast.error   { border-left: 3px solid var(--c-danger); }
.toast.warning { border-left: 3px solid var(--c-warning); }
.toast.info    { border-left: 3px solid var(--c-info); }
@keyframes slideInToast {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Drag and drop ──────────────────────────────────── */
.kanban-col.drag-over {
  border-color: var(--c-primary);
  background: rgba(124,106,247,0.05);
}
.task-card.drag-placeholder {
  border: 2px dashed var(--c-primary);
  background: var(--c-primary-dim);
  opacity: 0.5;
}

/* ─── Separador ──────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--c-border);
  border: none;
  margin: 0;
}

/* ─── Tag/Chip de empresa ────────────────────────────── */
.company-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--t-xs); font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--c-surface-3);
  color: var(--c-text-2);
}
.company-tag__dot {
  width: 6px; height: 6px; border-radius: var(--r-full);
  flex-shrink: 0;
}

/* ─── Progress ring ──────────────────────────────────── */
.progress-ring { transform: rotate(-90deg); }
.progress-ring__track { fill: none; stroke: var(--c-surface-3); }
.progress-ring__fill  { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease-out); }

/* ─── Tabs ───────────────────────────────────────────── */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--c-border); margin-bottom: var(--s-5); }
.tab-item {
  padding: var(--s-2) var(--s-4);
  font-size: var(--t-sm); font-weight: 600;
  color: var(--c-text-3);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.tab-item:hover { color: var(--c-text-2); }
.tab-item.active { color: var(--c-primary-light); border-bottom-color: var(--c-primary); }

/* ─── Sección vacía ──────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--s-12) var(--s-6);
  text-align: center; color: var(--c-text-3);
}
.empty-state__icon  { font-size: 40px; margin-bottom: var(--s-4); opacity: 0.35; }
.empty-state__title { font-size: var(--t-lg); font-weight: 600; color: var(--c-text-2); margin-bottom: var(--s-2); }
.empty-state__body  { font-size: var(--t-sm); max-width: 280px; line-height: 1.6; }

/* ─── Loading skeleton ───────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--c-surface-2) 25%,
    var(--c-surface-3) 50%,
    var(--c-surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

/* ─── Inline edit ────────────────────────────────────── */
.inline-edit {
  display: inline-flex; align-items: center; gap: var(--s-1);
}
.inline-edit__trigger {
  cursor: text;
  padding: 2px 4px;
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) ease;
}
.inline-edit__trigger:hover { background: var(--c-surface-3); }

/* ─── Confirmación ───────────────────────────────────── */
.confirm-dialog {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-hi);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.confirm-dialog__title { font-size: var(--t-lg); font-weight: 700; margin-bottom: var(--s-2); }
.confirm-dialog__body  { font-size: var(--t-sm); color: var(--c-text-2); margin-bottom: var(--s-6); }
.confirm-dialog__actions { display: flex; gap: var(--s-3); justify-content: center; }

/* ─── Panel de gestión (sección lateral) ─────────────── */
.mgmt-panel {
  background: var(--c-surface-1);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.mgmt-panel__header {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.mgmt-panel__title { font-size: var(--t-sm); font-weight: 700; }
.mgmt-panel__body  { padding: var(--s-4) var(--s-5); }
.mgmt-panel__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--c-border);
  gap: var(--s-3);
}
.mgmt-panel__row:last-child { border-bottom: none; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .kanban {
    grid-template-columns: repeat(auto-fill, 230px);
    grid-auto-columns: 230px;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: var(--sidebar-collapsed);
  }
  .sidebar__logo-text,
  .sidebar__logo-sub,
  .sidebar__logo-pmo,
  .sidebar__logo-texts,
  .nav-item__badge,
  .nav-item__label,
  .sidebar__section,
  .sidebar__user-info { display: none; }
  .sidebar__logo-symbol { width: 36px; height: 36px; margin: 0 auto; }
  .sidebar__logo-brand { justify-content: center; }
  .nav-item { justify-content: center; padding: var(--s-3); gap: 0; }
  .sidebar__logo { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar__user { justify-content: center; }
  .kanban { grid-template-columns: repeat(auto-fill, 220px); grid-auto-columns: 220px; max-height: calc(100vh - 175px); }
  .kanban-col { max-height: calc(100vh - 175px); }
}

@media (max-width: 768px) {
  /* Anular stacking context del app-shell para que sidebar fixed z-300 compita en el contexto raíz */
  .app-shell { z-index: auto; }
  .topbar { padding: 0 var(--s-4); overflow: visible; }
  /* En mobile ocultar la barra de búsqueda inline (se muestra al tocar la lupa) */
  .topbar__left .topbar__search:not(.mobile-open) { display: none; }
  .topbar__search {
    position: fixed;
    top: var(--topbar-h);
    left: 0; right: 0;
    z-index: 45;
    max-width: 100%;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    background: var(--c-surface-2);
    display: none;
    padding: var(--s-2) var(--s-4);
  }
  .topbar__search.mobile-open { display: flex; }
  .topbar__search-toggle { display: flex !important; }
  .topbar__hamburger { display: flex; }
  /* Touch targets mínimos WCAG 2.5.5 — excluir ojitos de contraseña en login */
  .btn--icon:not(.pass-eye-btn)    { width: 44px; height: 44px; }
  .btn--icon-sm { width: 36px; height: 36px; }
  .btn--xs { min-height: 36px; padding-top: var(--s-2); padding-bottom: var(--s-2); }
  /* Checkboxes de subtareas: 24px en mobile (antes 14-15px) — 44px real sería
     desproporcionado en una fila de texto con gap de 8px (invadiría el vecino). */
  .subtask-item__check input[type=checkbox] { width: 24px; height: 24px; }
  /* Topbar actions: reducir gap y ocultar textos para ahorrar espacio */
  .topbar__actions { gap: var(--s-1); }
  /* Ocultar texto "Nueva tarea" en mobile — dejar solo el ícono + */
  .topbar__actions .btn--primary span { display: none !important; }
  /* Convertir "Nueva tarea" a btn--icon en mobile */
  .topbar__actions .btn--primary { width: 36px; height: 36px; padding: 0; justify-content: center; }
  /* Ocultar botón "Equipo" texto en mobile */
  .topbar__actions .btn--sm:not(.btn--primary) { display: none; }
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar {
    /* z-index 300: drawer modal sobre el overlay */
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 80vw !important;
    max-width: 300px !important;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar__logo-symbol { width: 34px !important; height: 34px !important; }
  .sidebar__logo-brand { justify-content: flex-start !important; }
  .nav-item { justify-content: flex-start; padding: var(--s-2) var(--s-4); gap: var(--s-3); }
  .sidebar__logo { justify-content: flex-start; padding-left: var(--s-5); }
  .sidebar__user { justify-content: flex-start; }
  .main { padding: var(--s-4); min-width: 0; }
  .sidebar-overlay {
    /* z-index 290: tapa el contenido (z≤50) pero queda bajo el sidebar (300) */
    /* backdrop-filter removido: crea stacking context en iOS que captura el sidebar */
    position: fixed; inset: 0; z-index: 290;
    background: rgba(5,6,11,0.6);
    display: none;
  }
  .sidebar-overlay.open { display: block; }
  .modal { border-radius: var(--r-xl); }
  .drawer { width: 100% !important; max-width: 100%; }
  /* Kanban en mobile: scroll horizontal con snap por columna */
  .kanban {
    grid-template-columns: repeat(auto-fill, 85vw);
    grid-auto-columns: 85vw;
    gap: var(--s-3);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-left: var(--s-4);
  }
  .kanban-col { max-height: calc(100vh - 140px); min-height: 260px; scroll-snap-align: start; }
  .ct-col    { height: calc(100vh - 200px); min-height: 260px; scroll-snap-align: start; }
  /* Notif panel: ajuste móvil — ancho limitado al viewport, altura al espacio disponible */
  .notif-panel {
    width: calc(100vw - var(--s-6));
    max-width: calc(100vw - var(--s-6));
    right: 0;
    left: auto;
    max-height: calc(100vh - var(--topbar-h) - var(--s-4));
  }
}

@media (max-width: 640px) {
  .team-grid { grid-template-columns: 1fr 1fr; }
  .gantt-filter-select { min-width: 120px; font-size: var(--t-xs); }
  .toast-container { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); }
  .toast { min-width: 0; max-width: 100%; }
  .gantt-source-tabs .btn { font-size: var(--t-xs); padding: .25rem .5rem; }
  /* Drawer grid colapsa antes en pantallas estrechas */
  .drawer__grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .drawer__grid { grid-template-columns: 1fr; }
  .modal__body { padding: var(--s-4); }
  .modal__header, .modal__footer { padding: var(--s-4); }
  .page-header__top { flex-direction: column; align-items: stretch; }
  .page-header__actions { flex-wrap: wrap; gap: var(--s-2); width: 100%; }
  .page-header__heading { font-size: var(--t-xl); }
  .member-card__main-btn { font-size: var(--t-xs); }
  /* Kanban columnas de ancho casi completo para deslizar con el dedo */
  .kanban { grid-template-columns: repeat(auto-fill, 88vw); grid-auto-columns: 88vw; max-height: calc(100vh - 130px); }
  .kanban-col { max-height: calc(100vh - 130px); min-height: 240px; }
  .ct-col    { height: calc(100vh - 170px); min-height: 240px; }
  /* Settings inner-grid colapsa en móvil */
  .settings-inner-grid { grid-template-columns: 1fr; }
  .settings-inner-grid > * { min-width: 0; }
  /* Fase 5-6: responsive chips y acciones de scope change */
  .go-live-chips { gap:var(--s-1); }
  .scope-change-card__actions { flex-direction: column; }
  .scope-change-card__actions .btn { width: 100%; justify-content: center; }
  .scope-change-card__task-chip { font-size:var(--t-2xs); }
}

/* ══════════════════════════════════════════════════════
   CAMPANA DE NOTIFICACIONES
   ══════════════════════════════════════════════════════ */
.notif-bell-wrap { position: relative; }
/* overflow:visible para que el badge absoluto no quede recortado por .btn overflow:hidden */
.notif-bell { position: relative; overflow: visible !important; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  background: var(--c-danger);
  color: #fff;
  font-size: var(--t-2xs); font-weight: 700;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  border: 2px solid var(--c-bg);
  line-height: 1;
  z-index: 1;
}
.notif-panel {
  position: absolute; top: calc(100% + var(--s-2)); right: 0;
  width: 360px; max-height: 480px;
  background: var(--c-surface-1);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  display: flex; flex-direction: column;
  overflow: visible;
  animation: fadeSlideDown var(--dur-normal) var(--ease-out);
}
.notif-panel__body {
  overflow-y: auto;
  flex: 1;
  max-height: 380px;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.notif-panel__title { font-weight: 700; font-size: var(--t-sm); }
.notif-item {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  transition: background var(--dur-fast) ease;
  position: relative;
}
.notif-item:hover { background: var(--c-surface-3); }
.notif-item--unread { background: color-mix(in srgb, var(--c-primary) 5%, transparent); }
.notif-item--unread:hover { background: color-mix(in srgb, var(--c-primary) 10%, transparent); }
.notif-item__icon {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--c-surface-3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-item__content { flex: 1; min-width: 0; }
.notif-item__title { font-size: var(--t-sm); font-weight: 600; line-height: 1.3; word-break: break-word; overflow-wrap: anywhere; }
.notif-item__body { font-size: var(--t-xs); color: var(--c-text-2); margin-top: 2px; line-height: 1.4; word-break: break-word; overflow-wrap: anywhere; }
.notif-item__time { font-size: var(--t-2xs); color: var(--c-text-3); margin-top: 3px; }
.notif-item__dot {
  width: 8px; height: 8px; border-radius: var(--r-full);
  background: var(--c-primary);
  flex-shrink: 0; margin-top: 4px;
}
.notif-empty { padding: var(--s-8); text-align: center; color: var(--c-text-3); font-size: var(--t-sm); }

/* ══════════════════════════════════════════════════════
   CALENDARIO
   ══════════════════════════════════════════════════════ */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--c-border);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--s-4);
}
.cal-header-cell {
  background: var(--c-surface-2);
  padding: var(--s-2) var(--s-3);
  text-align: center;
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-3);
}
.cal-cell {
  background: var(--c-surface-1);
  min-height: 100px;
  padding: var(--s-2);
  transition: background var(--dur-fast) ease;
}
.cal-cell:hover { background: var(--c-surface-2); }
.cal-cell--empty { background: var(--c-bg); }
.cal-cell--today {
  background: color-mix(in srgb, var(--c-primary) 8%, var(--c-surface-1));
  border: 1px solid color-mix(in srgb, var(--c-primary) 40%, transparent);
}
.cal-cell--overdue {
  background: color-mix(in srgb, var(--c-danger) 5%, var(--c-surface-1));
}
.cal-cell__day {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--c-text-2);
  margin-bottom: var(--s-1);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
}
.cal-cell--today .cal-cell__day {
  background: var(--c-primary);
  color: #fff;
}
.cal-cell__tasks { display: flex; flex-direction: column; gap: 2px; }
.cal-task {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: var(--t-xs);
  cursor: pointer;
  overflow: hidden;
  transition: background var(--dur-fast) ease;
  line-height: 1.3;
}
.cal-task:hover { filter: brightness(1.15); }
.cal-task--critical { background: color-mix(in srgb, var(--pri-critical) 15%, var(--c-surface-3)); color: var(--pri-critical); }
.cal-task--high     { background: color-mix(in srgb, var(--pri-high)     15%, var(--c-surface-3)); color: var(--pri-high); }
.cal-task--medium   { background: color-mix(in srgb, var(--pri-medium)   15%, var(--c-surface-3)); color: var(--pri-medium); }
.cal-task--low      { background: color-mix(in srgb, var(--pri-low)      15%, var(--c-surface-3)); color: var(--pri-low); }
.cal-task__dot      { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.cal-task__title    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal-task__more     { font-size: var(--t-2xs); color: var(--c-text-3); padding: 1px 5px; }

/* ══════════════════════════════════════════════════════
   CONFIGURACIÓN / SETTINGS
   ══════════════════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;        /* apilado por defecto */
  gap: var(--s-5);
  max-width: 860px;                  /* ancho cómodo de lectura */
}
@media (min-width: 960px) {
  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .settings-card--full {
    grid-column: 1 / -1;            /* SMTP ocupa todo el ancho */
  }
}
.settings-card { padding: var(--s-5); }
.settings-card__title {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-3);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--c-border);
}
.settings-card__title svg { flex-shrink: 0; color: var(--c-primary); }
/* campos internos: siempre una columna en settings para legibilidad */
.settings-card .field { margin-bottom: 0; }
.settings-inner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3) var(--s-4);
  align-items: start;
}
.settings-inner-grid > * { min-width: 0; }
.settings-inner-grid .field--full { grid-column: 1 / -1; }
.settings-footer {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.settings-toggle-row {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--c-surface-3);
  cursor: pointer;
  transition: background var(--dur-fast);
  margin-bottom: var(--s-4);
}
.settings-toggle-row:hover { background: var(--c-surface-4); }
.settings-toggle-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--c-primary);
  flex-shrink: 0; margin-top: 2px;
}

/* ── Pestañas de Configuración ───────────────────────── */
.cfg-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: var(--s-6);
  overflow-x: auto;
  scrollbar-width: none;
}
.cfg-tabs::-webkit-scrollbar { display: none; }
.cfg-tab {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  font-size: var(--t-sm); font-weight: 600;
  color: var(--c-text-3);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.cfg-tab:hover { color: var(--c-text-1); background: var(--c-surface-2); }
.cfg-tab.active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
}
.cfg-tab svg { flex-shrink: 0; }
.cfg-panel { display: none; }
.cfg-panel.active { display: block; }

/* ══════════════════════════════════════════════════════
   MARIA — CHAT FLOTANTE
   ══════════════════════════════════════════════════════ */
#maria-widget {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  z-index: 155;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-3);
  transition: right var(--dur-normal) var(--ease-out);
}
body.drawer-open #maria-widget {
  right: calc(500px + var(--s-6));
}
@media (max-width: 768px) {
  body.drawer-open #maria-widget { display: none; }
}
.maria-fab {
  display: flex; align-items: center; gap: var(--s-2);
  background: linear-gradient(135deg, var(--c-primary) 0%, #a78bfa 100%);
  color: #fff;
  border: none; border-radius: var(--r-full);
  padding: var(--s-3) var(--s-5);
  font-size: var(--t-sm); font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(124,106,247,0.45), 0 0 0 1px rgba(124,106,247,0.2);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease;
}
.maria-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 32px rgba(124,106,247,0.55), 0 0 0 1px rgba(124,106,247,0.3);
}
.maria-fab:active { transform: scale(0.97); }
.maria-fab-label { font-size: var(--t-sm); font-weight: 700; }
.maria-chat {
  width: 380px;
  max-height: 520px;
  background: var(--c-surface-1);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(124,106,247,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: mariaOpen var(--dur-normal) var(--ease-out);
}
@keyframes mariaOpen {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.maria-chat__header {
  display: flex; align-items: center; gap: var(--s-1);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
  flex-shrink: 0;
}
.maria-chat__title { display: flex; align-items: center; gap: var(--s-3); flex: 1; min-width: 0; }
.maria-avatar {
  width: 32px; height: 32px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--c-primary) 0%, #a78bfa 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: var(--t-sm); color: #fff;
  box-shadow: 0 0 0 2px var(--c-border);
}
.maria-chat__body {
  flex: 1; overflow-y: auto;
  padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3);
  scroll-behavior: smooth;
}
.maria-chat__suggestions {
  padding: var(--s-2) var(--s-3) 0;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.maria-chat__footer {
  display: flex; align-items: flex-end; gap: var(--s-2);
  padding: var(--s-2) var(--s-3) var(--s-3);
  background: var(--c-surface-2);
  flex-shrink: 0;
}
.maria-input {
  flex: 1; resize: none; min-height: 40px; max-height: 120px;
  font-size: var(--t-sm);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-2) var(--s-3);
  line-height: 1.5;
  overflow-y: auto;
}
.maria-input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-dim); }
.maria-send-btn {
  width: 36px; height: 36px; padding: 0;
  flex-shrink: 0;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.maria-send-btn:hover:not(:disabled) { box-shadow: 0 2px 8px rgba(124,106,247,0.35); }
.maria-send-btn:active:not(:disabled) { transform: scale(0.93); }
.maria-send-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.maria-msg {
  display: flex; gap: var(--s-2); align-items: flex-start;
  animation: msgIn var(--dur-normal) var(--ease-out);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.maria-msg--user {
  flex-direction: row-reverse;
}
.maria-msg__avatar {
  width: 28px; height: 28px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--c-primary) 0%, #a78bfa 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: var(--t-xs); color: #fff;
  flex-shrink: 0;
}
.maria-msg__bubble {
  max-width: 82%;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-lg);
  font-size: var(--t-sm);
  line-height: 1.55;
}
.maria-msg__bubble p { margin: 0 0 var(--s-2); }
.maria-msg__bubble p:last-child { margin-bottom: 0; }
.maria-msg--assistant .maria-msg__bubble {
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-bottom-left-radius: 4px;
}
.maria-msg--user .maria-msg__bubble {
  background: var(--c-primary-dim);
  color: var(--c-primary-light);
  border: 1px solid color-mix(in srgb, var(--c-primary) 30%, transparent);
  border-bottom-right-radius: 4px;
}
.maria-typing-dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-text-3);
  margin: 0 2px;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.maria-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.maria-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── MarIA action pills (confirmación de acciones) ─── */
.maria-action-pill {
  display: flex; align-items: center; gap: var(--s-2);
  background: color-mix(in srgb, var(--c-success) 12%, var(--c-surface-2));
  border: 1px solid color-mix(in srgb, var(--c-success) 30%, transparent);
  border-radius: var(--r-lg);
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-xs);
  color: var(--c-success);
  margin: 0 0 var(--s-1) 0;
  animation: msgIn var(--dur-normal) var(--ease-out);
  align-self: flex-start;
  max-width: 90%;
}
.maria-action-pill__icon {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: color-mix(in srgb, var(--c-success) 20%, transparent);
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.maria-action-pill__text { flex: 1; font-weight: 600; }
.maria-action-pill__link {
  background: color-mix(in srgb, var(--c-success) 20%, transparent);
  color: var(--c-success);
  border: none; border-radius: var(--r-md);
  padding: 2px 8px; font-size: var(--t-2xs); font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) ease;
}
.maria-action-pill__link:hover {
  background: color-mix(in srgb, var(--c-success) 35%, transparent);
}

/* ── Sugerencias rápidas en el chat ─────────────────── */
.maria-suggestions {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  padding: var(--s-2) 0 var(--s-1);
}
.maria-suggestion-chip {
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: var(--s-1) var(--s-3);
  font-size: var(--t-xs); color: var(--c-text-2);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.maria-suggestion-chip:hover {
  background: var(--c-primary-dim);
  color: var(--c-primary-light);
  border-color: color-mix(in srgb, var(--c-primary) 40%, transparent);
}

/* ─── Responsive nuevos componentes ──────────────────── */
@media (max-width: 768px) {
  /* Regla cubierta por el bloque principal @media 768px — sin duplicar */
  .maria-chat  { width: calc(100vw - var(--s-8)); max-height: 75vh; }
  #maria-widget { bottom: var(--s-4); right: var(--s-4); }
  .cal-grid { font-size: var(--t-xs); }
  .cal-cell { min-height: 60px; }
  .settings-grid { grid-template-columns: 1fr !important; }
  .settings-card--full { grid-column: 1 !important; }
  .settings-inner-grid { grid-template-columns: 1fr; }
  .settings-inner-grid .field--full { grid-column: 1; }
  .cal-task__title { display: none; }
  .report-period-tabs { gap: var(--s-1); }
  .page-header__top { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .page-header__actions { width: 100%; flex-wrap: wrap; }
  .kanban { gap: var(--s-3); }
}
@media (max-width: 480px) {
  .cal-cell { min-height: 44px; padding: var(--s-1); }
  .cal-task { padding: 1px 3px; }
  .maria-chat { width: calc(100vw - var(--s-6)); }
  .settings-inner-grid { grid-template-columns: 1fr; }
}

/* ─── Animaciones de entrada ─────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.fade-up          { animation: fadeUp   var(--dur-normal) var(--ease-out) both; }
.fade-in          { animation: fadeIn   var(--dur-normal) ease both; }
.scale-in         { animation: scaleIn  var(--dur-normal) var(--ease-out) both; }
.fade-up-delay-1  { animation-delay: 50ms; }
.fade-up-delay-2  { animation-delay: 100ms; }
.fade-up-delay-3  { animation-delay: 150ms; }
.fade-up-delay-4  { animation-delay: 200ms; }
.fade-up-delay-5  { animation-delay: 250ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0ms !important;
    transition-duration: 0ms !important;
  }
}

/* ─── Reporte: tarjetas de proyecto ─────────────────── */
.report-project-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.report-project-card:hover {
  border-color: var(--c-border-hi);
  transform: translateY(-1px);
}
.report-period-tabs {
  display: flex; flex-wrap: wrap; gap: var(--s-1);
}

/* ─── Print ──────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .filters, .page-header__actions,
  .toast-container, .modal-overlay, .drawer, .drawer-overlay,
  #maria-widget, .report-period-tabs, .select-wrapper { display: none !important; }
  .main { padding: 0; }
  .app-shell { display: block; }
  body { background: #fff; color: #000; font-size: 11px; }
  .page-header { margin-bottom: 16px; }
  .page-header__heading { font-size: 18px; color: #7c6af7; }
  .stats-grid { display: flex !important; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .stat-card { border: 1px solid #ddd !important; background: #fafafa !important; padding: 8px 12px !important; min-width: 90px; }
  .stat-card__value { font-size: 20px !important; }
  .report-table { color: #000; font-size: 10px; }
  .report-table th { background: #f1f5f9 !important; color: #334155 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report-table th, .report-table td { border: 1px solid #e2e8f0 !important; padding: 4px 6px !important; }
  .badge { border: 1px solid #ccc; background: #f1f5f9 !important; color: #334155 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .chart-container { break-inside: avoid; }
  .fade-up { opacity: 1 !important; transform: none !important; }
  h2, h3 { break-after: avoid; }
  table { break-inside: auto; }
  tr { break-inside: avoid; }
}

/* ─── Sprint Panel ──────────────────────────────────── */
.sprint-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-height: 55vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}
.sprint-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast);
}
.sprint-row:hover { border-color: var(--c-border-hi); }
.sprint-row--active { border-color: var(--c-border-glow); background: var(--c-primary-dim); }
.sprint-row__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sprint-row__name { font-weight: 600; color: var(--c-text); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprint-row__dates { font-size: var(--t-xs); color: var(--c-text-3); }
.sprint-row__actions { display: flex; gap: var(--s-1); flex-shrink: 0; }
.sprint-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--c-surface-2);
  border: 1px dashed var(--c-border);
  border-radius: var(--r-md);
}
.sprint-form .field--full { grid-column: 1 / -1; }
.input--sm { font-size: var(--t-sm); padding: var(--s-1) var(--s-2); height: 32px; }
.sprint-btn--xs { font-size: var(--t-xs); padding: 3px 10px; height: 26px; }

/* ── Subtask items ───────────────────────────────────── */
.subtask-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  transition: background 0.15s;
}
.subtask-item:hover { background: var(--c-surface-3); }
.subtask-item__check { display:flex;align-items:center;flex-shrink:0; }
.subtask-item__check input[type=checkbox] { cursor: pointer; width: 14px; height: 14px; accent-color: var(--c-primary); }
.subtask-item__title {
  flex: 1;
  font-size: var(--t-sm);
  color: var(--c-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subtask-item--done .subtask-item__title {
  text-decoration: line-through;
  color: var(--c-text-3);
}
.subtask-item__title-input {
  flex: 1;
  font-size: var(--t-sm);
  color: var(--c-text-1);
  background: var(--c-surface-1);
  border: 1px solid var(--c-primary);
  border-radius: var(--r-xs);
  padding: 1px 4px;
  font-family: inherit;
}
.subtask-item__del {
  opacity: 0;
  padding: 2px;
  border-radius: var(--r-xs);
  flex-shrink: 0;
  color: var(--c-text-3);
  transition: opacity 0.15s, color 0.15s;
}
.subtask-item:hover .subtask-item__del { opacity: 1; }
@media (hover: none) {
  .subtask-item__del { opacity: 1; }
}
.subtask-item__del:hover { color: var(--c-danger); }

/* ═══════════════════════════════════════════════════════
   MÓDULO CORE TEAM
   ═══════════════════════════════════════════════════════ */

/* Loading */
.ct-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60vh;
}

/* Header — igual a .page-header del módulo de proyectos */
.ct-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--s-6);
  gap: var(--s-4);
  flex-wrap: wrap;
}
.ct-header__title {
  font-size: var(--t-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--c-text);
  margin: 0 0 var(--s-1);
}
.ct-header__sub {
  font-size: var(--t-sm);
  color: var(--c-text-3);
  margin: 0;
}
.ct-header__actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}
.ct-header__more {
  position: relative;
}
.ct-header__more-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ct-header__more-menu {
  position: fixed;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 192px;
  z-index: 9999;
  overflow: hidden;
}

/* Board — igual a .kanban pero con flex para depósitos variables */
.ct-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
  align-items: start;
  overflow-x: auto;
  padding-bottom: var(--s-6);
}

/* Declaraciones comunes con .kanban-col ya en la regla combinada de arriba */
.ct-col {
  height: calc(100vh - 190px);
}
.ct-col--drag-over {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px var(--c-primary-glow);
}
.ct-col__header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
  flex-shrink: 0;
}
.ct-col__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.ct-col__name {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-text-2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Menú contextual de columna CT */
.ct-col__name--editable {
  cursor: text;
  border-radius: 3px;
  padding: 1px 3px;
  transition: background var(--dur-fast) ease;
}
.ct-col__name--editable:hover { background: var(--c-surface-3); }

.ct-col__menu-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.ct-col__menu-btn {
  opacity: 0;
  transition: opacity var(--dur-fast) ease;
  width: 22px;
  height: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ct-col__header:hover .ct-col__menu-btn { opacity: 1; }
@media (hover: none) {
  .ct-col__menu-btn { opacity: 1; }
}
.ct-col__menu {
  position: fixed;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 9999;
  overflow: hidden;
}
.ct-col__menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-sm);
  color: var(--c-text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur-fast) ease;
}
.ct-col__menu-item:hover { background: var(--c-surface-3); }
.ct-col__menu-item--danger { color: var(--c-danger); }
.ct-col__menu-item--danger:hover { background: var(--c-danger-dim); }

.ct-col__count {
  font-size: var(--t-2xs);
  color: var(--c-text-3);
  background: var(--c-surface-3);
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-weight: 600;
}
.ct-col__add {
  margin-top: var(--s-2);
  width: 100%;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  background: transparent;
  border: 1px dashed var(--c-border);
  color: var(--c-text-3);
  font-size: var(--t-xs);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  transition: all var(--dur-fast) ease;
  flex-shrink: 0;
}
.ct-col__add:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-dim); }
.ct-col__tasks {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}
.ct-col__tasks::-webkit-scrollbar { width: 4px; }
.ct-col__tasks::-webkit-scrollbar-track { background: transparent; }
.ct-col__tasks::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: var(--r-full); }

/* Tarjeta — idéntica a .task-card */
.ct-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  cursor: grab;
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-normal) ease,
    border-color var(--dur-normal) ease,
    background var(--dur-fast) ease;
}
.ct-card:active { cursor: grabbing; }
.ct-card:hover {
  border-color: var(--c-border-hi);
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--shadow-md);
  background: var(--c-surface-3);
}
.ct-card.dragging {
  opacity: 0.35;
  transform: scale(0.97) rotate(1deg);
  box-shadow: var(--shadow-xl);
}
.ct-card__accent {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}
.ct-card__actions {
  position: absolute; top: var(--s-2); right: var(--s-2);
  display: none;
  gap: 2px;
}
.ct-card:hover .ct-card__actions { display: flex; }
@media (hover: none) {
  .ct-card__actions { display: flex; }
}
.ct-card--selected {
  border-color: var(--c-danger) !important;
  background: color-mix(in srgb, var(--c-danger) 8%, var(--c-surface-2));
}
.ct-card__bulk-check {
  position: absolute; top: var(--s-2); right: var(--s-2);
  display: flex; align-items: center; justify-content: center;
}
.ct-bulk-checkbox {
  width: 18px; height: 18px;
  border: 2px solid var(--c-border-hi);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--c-surface-1);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ct-bulk-checkbox--checked {
  border-color: var(--c-danger);
  background: var(--c-danger);
  color: #fff;
}
.ct-card__header {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  flex-wrap: wrap;
}
.ct-card__pri,
.ct-card__status {
  font-size: var(--t-2xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  text-transform: uppercase;
}
.ct-card__title {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text);
  line-height: 1.4;
  margin-bottom: var(--s-2);
}
.ct-card__labels {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  margin-bottom: var(--s-2);
}
.ct-label-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--t-xs);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.ct-label-pill__rm {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  font-size: 13px;
  line-height: 1;
  padding: 0 0 0 2px;
}
.ct-label-pill__rm:hover { opacity: 1; }
.ct-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-2);
}
.ct-card__meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.ct-card__due {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.ct-card__due--overdue { color: var(--c-danger); }
.ct-card__assignees {
  display: flex;
  gap: -4px;
}
.ct-card__comment {
  margin-top: var(--s-2);
  font-size: var(--t-xs);
  color: var(--c-text-3);
  display: flex;
  align-items: flex-start;
  gap: var(--s-1);
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-2);
  line-height: 1.4;
}
.ct-card__comment span {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Avatar — usa el sistema .avatar global */
.ct-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: var(--c-text-inv);
  font-size: var(--t-2xs);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.ct-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ct-avatar--sm {
  width: 22px;
  height: 22px;
  font-size: var(--t-2xs);
}

/* Drawer */
.ct-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 500px;
  max-width: 96vw;
  height: 100vh;
  background: var(--c-surface-1);
  border-left: 1px solid var(--c-border-hi);
  z-index: 160;
  overflow-y: auto;
  transition: transform var(--dur-normal) var(--ease-out);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
.ct-drawer--closed {
  transform: translateX(100%);
}
.ct-drawer__inner {
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
/* Topbar sticky: fila 1 = acciones + X | fila 2 = badges de prioridad/estado */
.ct-drawer__topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--c-surface-1);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-1);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
/* Fila 1: acciones a la izquierda, X pegado a la derecha */
.ct-drawer__topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.ct-drawer__topbar-close {
  margin-left: auto;
  flex-shrink: 0;
}
/* Fila 2: badges de prioridad y estado */
.ct-drawer__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.ct-drawer__pending-approval {
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.28);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-sm);
  color: var(--c-text-2);
  margin-bottom: var(--s-4);
}
.ct-drawer__title {
  font-size: var(--t-xl);
  font-weight: 800;
  color: var(--c-text);
  margin: 0;
  line-height: 1.3;
}
.ct-drawer__meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  background: var(--c-surface-3);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  border: 1px solid var(--c-border);
}
.ct-drawer__meta-item { display: flex; flex-direction: column; gap: var(--s-1); }
.ct-drawer__meta-label {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
}
.ct-drawer__desc {
  font-size: var(--t-sm);
  color: var(--c-text-2);
  background: var(--c-surface-3);
  border-radius: var(--r-md);
  padding: var(--s-3);
  border: 1px solid var(--c-border);
  line-height: 1.6;
}
.ct-drawer__section {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.ct-drawer__section-title {
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-3);
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
.ct-drawer__assignee {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-sm);
  color: var(--c-text);
}
.ct-drawer__empty {
  font-size: var(--t-sm);
  color: var(--c-text-3);
  font-style: italic;
}
.ct-labels-row { display: flex; flex-wrap: wrap; gap: var(--s-1); }

/* Chat de comentarios */
.ct-drawer__chat { min-height: 200px; }
.ct-comments {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-height: 300px;
  overflow-y: auto;
  padding-right: var(--s-1);
}
.ct-comments::-webkit-scrollbar { width: 4px; }
.ct-comments::-webkit-scrollbar-thumb { background: var(--c-border-hi); border-radius: 2px; }
.ct-comment {
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-3);
}
.ct-comment__header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  flex-wrap: wrap;
}
.ct-comment__header strong { font-size: var(--t-sm); color: var(--c-text); }
.ct-comment__time {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  flex: 1;
}
.ct-comment__edit-btn { opacity: 0; transition: opacity .15s; }
.ct-comment:hover .ct-comment__edit-btn { opacity: 1; }
@media (hover: none) {
  .ct-comment__edit-btn { opacity: 1; }
}
.ct-comment__body {
  font-size: var(--t-sm);
  color: var(--c-text-2);
  line-height: 1.6;
}
.ct-comment__body a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.ct-comment__body a:hover { opacity: .85; }
.ct-comment-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
  margin-top: var(--s-2);
}
.ct-comment-form__actions { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); }

/* Adjuntos de comentarios de Core Team — preview antes de enviar y thumbnails ya publicados */
.ct-attachment-preview { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ct-attachment-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-1) var(--s-2);
  background: var(--c-bg-2);
  border-radius: var(--r-md);
  font-size: var(--t-xs);
  max-width: 180px;
}
.ct-attachment-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: var(--r-sm); flex-shrink: 0; }
.ct-attachment-chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-attachment-chip__rm { flex-shrink: 0; }
.ct-comment__attachments { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.ct-comment__attachment-thumb {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-1) var(--s-2);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: var(--t-xs);
  text-decoration: none;
  color: var(--c-text-2);
  max-width: 160px;
}
.ct-comment__attachment-thumb img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--r-sm); flex-shrink: 0; }
.ct-comment__attachment-thumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Label manager */
.ct-label-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-1);
  border-radius: var(--r-md);
}
.ct-label-row:hover { background: var(--c-surface-3); }
.ct-label-swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--r-xs);
  flex-shrink: 0;
}
.ct-label-row__name {
  flex: 1;
  font-size: var(--t-sm);
  color: var(--c-text);
}

/* Responsive Core Team */
@media (max-width: 768px) {
  .ct-drawer { width: 100vw; max-width: 100vw; }
  .ct-board  { grid-template-columns: 1fr; }
  .ct-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .ct-drawer__meta-grid { grid-template-columns: 1fr; }
  .ct-header__actions { flex-wrap: wrap; }
}

/* ── Importación masiva CSV ──────────────────────────── */
.imp-dropzone {
  border: 2px dashed var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-8) var(--s-6);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
  color: var(--c-text-3);
}
.imp-dropzone:hover,
.imp-dropzone--over {
  border-color: var(--c-primary);
  background: var(--c-primary-dim);
  color: var(--c-text);
}

/* ─── Gantt ──────────────────────────────────────────── */
.gantt-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface-2);
}

.gantt-svg {
  display: block;
  font-family: var(--font-sans);
  min-width: 100%;
}

.gantt-label-bg {
  fill: var(--c-surface-3);
}

.gantt-label {
  font-size: var(--t-xs);
  fill: var(--c-text-2);
  dominant-baseline: middle;
}

.gantt-month {
  font-size: var(--t-xs);
  font-weight: 600;
  fill: var(--c-text-1);
}

.gantt-day {
  font-size: var(--t-2xs);
  fill: var(--c-text-3);
  text-anchor: middle;
}

.gantt-gridline {
  stroke: var(--c-border);
  stroke-width: 1;
}

.gantt-divider {
  stroke: var(--c-border-hi);
  stroke-width: 1;
}

.gantt-weekend {
  fill: var(--c-border);
  opacity: 0.5;
}

.gantt-row-alt {
  fill: var(--c-surface-3);
  opacity: 0.5;
}

.gantt-bar {
  transition: filter 0.15s ease;
}

.gantt-bar-g:hover .gantt-bar {
  filter: brightness(1.15);
}

.gantt-bar-label {
  font-size: var(--t-2xs);
  font-weight: 600;
  fill: rgba(255,255,255,0.9);
  dominant-baseline: middle;
}

.gantt-today {
  stroke: var(--c-primary);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  opacity: 0.8;
}

.gantt-filter-select {
  appearance: none;
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-1);
  font-size: var(--t-xs);
  padding: .3rem .8rem .3rem .6rem;
  cursor: pointer;
  min-width: 160px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .5rem center;
  padding-right: 1.6rem;
}
.gantt-filter-select:hover { border-color: var(--c-border-hi); }
/* :focus-visible (más abajo, sección Accesibilidad) ya cubre el estado de foco con
   box-shadow de refuerzo AAA — esta regla ad-hoc solo cambiaba border-color y aplicaba
   también a clic de mouse (no solo teclado), inconsistente con el resto de inputs. */

.gantt-label-group {
  dominant-baseline: auto;
}

/* ─── Gantt — lista de Backlog (sin fechas) ──────────── */
.gantt-backlog-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--c-border);
}
.gantt-backlog-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--c-surface-1);
  transition: background 0.12s;
}
.gantt-backlog-row:hover { background: var(--c-surface-2); }
.gantt-backlog-row__accent {
  width: 4px;
  align-self: stretch;
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.gantt-backlog-row__group {
  font-size: var(--t-2xs);
  font-weight: 600;
  opacity: 0.85;
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gantt-backlog-row__title {
  flex: 1;
  min-width: 0;
  font-size: var(--t-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gantt-backlog-row__assignee {
  font-size: var(--t-2xs);
  color: var(--c-text-3);
  flex-shrink: 0;
}

/* ─── Reporte — panel de tarea inline ────────────────── */
.report-task-panel {
  margin: var(--s-4) 0 var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface-1);
  overflow: hidden;
  animation: fadeSlideIn .18s ease;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.report-task-panel__loading {
  display: flex;
  justify-content: center;
  padding: var(--s-6);
  color: var(--c-text-3);
}
.report-task-panel__inner {
  padding: var(--s-4) var(--s-5);
}
.report-task-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-border);
}
.report-task-panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-3) var(--s-5);
  margin-bottom: var(--s-4);
}
.report-task-panel__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--t-sm);
}
.report-task-panel__label {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.report-task-panel__comments {
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.report-task-panel__comment {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  font-size: var(--t-sm);
}
/* Fila activa en la tabla */
.report-table tbody tr.report-row--active {
  background: var(--c-primary-dim);
  outline: 2px solid var(--c-primary);
  outline-offset: -1px;
}
@media (max-width: 640px) {
  .report-task-panel__header { flex-direction: column; gap: var(--s-2); }
  .report-task-panel__inner  { padding: var(--s-3); }
  .report-task-panel__grid   { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .report-task-panel__grid   { grid-template-columns: 1fr; }
}

/* ─── CT Sección finalizadas ──────────────────────────── */
.ct-done-section {
  margin: var(--s-6) var(--s-4) var(--s-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface-1);
  overflow: hidden;
}
.ct-done-section__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-text-2);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.ct-done-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  padding: var(--s-4);
}
.ct-done-group {
  flex: 1 1 260px;
  min-width: 220px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
}
.ct-done-group__header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--s-2);
  flex-shrink: 0;
}
.ct-done-group__cards {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-height: calc(100vh - 340px);
  min-height: 120px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}
.ct-done-group__cards::-webkit-scrollbar { width: 4px; }
.ct-done-group__cards::-webkit-scrollbar-track { background: transparent; }
.ct-done-group__cards::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: var(--r-full); }
.ct-card--done {
  opacity: .65;
  filter: grayscale(.4);
  cursor: pointer;
}
.ct-card--done:hover {
  opacity: .9;
  filter: none;
}
.ct-card--done .ct-card__title {
  text-decoration: line-through;
  color: var(--c-text-3);
}

/* ─── User Picker (apoyo multi-selección) ─────────────── */
.user-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: var(--s-2);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  min-height: 42px;
}
.user-picker__chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  border-radius: var(--r-xl);
  border: 1px solid var(--c-border);
  background: var(--c-surface-3);
  color: var(--c-text-2);
  font-size: var(--t-sm);
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.user-picker__chip:hover {
  border-color: var(--c-border-hi);
  color: var(--c-text-1);
}
.user-picker__chip.selected {
  background: var(--c-primary-dim-hi);
  border-color: var(--c-primary);
  color: var(--c-primary-light);
}
.user-picker__chip .chip-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c-primary-dim);
  color: var(--c-primary-light);
  font-size: var(--t-2xs);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-picker__chip.selected .chip-avatar {
  background: var(--c-primary);
  color: #fff;
}

/* ─── Vista persistente (Mi Perfil / Organigrama) ───────── */
.view {
  grid-area: main;
  padding: var(--s-6);
  overflow-y: auto;
  overflow-x: auto;
  min-width: 0;
}

/* ─── View header / title ────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-5);
  gap: var(--s-3);
}
.view-title {
  font-size: var(--t-2xl);
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.2;
}

/* ─── Loading spinner ────────────────────────────────────── */
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: block;
}

/* ─── Form fields (Mi Perfil) ────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.form-label {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text-2);
}
.form-input {
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  color: var(--c-text);
  font-size: var(--t-base);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  width: 100%;
  resize: vertical;
}
.form-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-dim, rgba(124,106,247,.18));
}
.form-input::placeholder { color: var(--c-text-4, var(--c-text-3)); }

/* ── Sidebar drawer móvil — override final (mayor precedencia por posición) ── */
@media (max-width: 768px) {
  /* Cuando el drawer está abierto, anular TODOS los estilos de sidebar--collapsed */
  .sidebar.open.sidebar--collapsed,
  .sidebar.open {
    width: 80vw !important;
    max-width: 300px !important;
  }
  .sidebar.open .sidebar__logo-texts,
  .sidebar.open .sidebar__section,
  .sidebar.open .sidebar__user-info,
  .sidebar.open .sidebar__user > a span,
  .sidebar.open .nav-item__label,
  .sidebar.open .nav-item__badge {
    display: revert !important;
    opacity: 1 !important;
    max-width: 200px !important;
    white-space: normal !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }
  .sidebar.open .sidebar__logo-text,
  .sidebar.open .sidebar__logo-sub,
  .sidebar.open .sidebar__logo-pmo {
    display: inline !important;
    opacity: 1 !important;
  }
  .sidebar.open .nav-item {
    display: flex !important;
    justify-content: flex-start !important;
    padding: var(--s-2) var(--s-4) !important;
    gap: var(--s-3) !important;
  }
  .sidebar.open .nav-item__icon { margin: 0 !important; width: 18px !important; height: 18px !important; opacity: 1 !important; }
  .sidebar.open .sidebar__logo { justify-content: flex-start !important; padding: 0 var(--s-5) var(--s-5) !important; overflow: visible !important; }
  .sidebar.open .sidebar__logo-brand { justify-content: flex-start !important; min-width: unset !important; }
  .sidebar.open .sidebar__user { justify-content: flex-start !important; padding: var(--s-3) var(--s-4) !important; gap: var(--s-3) !important; }
  .sidebar.open .sidebar__user-avatar { display: flex !important; }
  .sidebar.open .sidebar__logout-btn { margin: 0 !important; }
  .sidebar.open .sidebar__nav { padding: var(--s-2) 0 !important; }
}

/* ══════════════════════════════════════════════════════
   ACCESIBILIDAD — Focus visible (WCAG 2.1 criterio 2.4.7)
   Garantiza indicador visible para navegación por teclado.
   ══════════════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.form-input:focus-visible,
.chat-footer__input:focus-visible,
.maria-input:focus-visible,
.gantt-filter-select:focus-visible {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-dim), 0 0 0 4px var(--c-primary);
}
.btn:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
.topbar__search input:focus-visible {
  outline: 1px solid var(--c-primary);
  outline-offset: 0;
  border-radius: var(--r-sm);
}

/* ══════════════════════════════════════════════════════
   CHAT — Toast flotante (globo de notificación)
   100% tokens del design system — coherente con modales,
   drawers y toasts existentes. Responsive mobile-first.
   ══════════════════════════════════════════════════════ */
#chat-float-toast {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - var(--s-8));
  transform: translateY(var(--s-5));
  opacity: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
  pointer-events: none;
}
#chat-float-toast.cft--visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}
.cft__inner {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border-hi);
  border-radius: var(--r-xl);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--c-border-glow);
}
.cft__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--c-primary-dim);
  border: 2px solid var(--c-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--c-primary);
  overflow: hidden;
}
.cft__content { flex: 1; min-width: 0; }
.cft__sender {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: var(--s-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cft__body {
  font-size: var(--t-sm);
  color: var(--c-text);
  line-height: 1.4;
  margin-bottom: var(--s-2);
  word-break: break-word;
}
.cft__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.cft__reply-input {
  flex: 1;
  background: var(--c-surface-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: var(--s-1) var(--s-3);
  font-size: var(--t-xs);
  font-family: var(--font-sans);
  color: var(--c-text);
  outline: none;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.cft__reply-input::placeholder { color: var(--c-text-3); }
.cft__reply-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-dim);
}
.cft__btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.cft__btn:active { transform: scale(.92); }
.cft__btn--send { background: var(--c-primary); color: #fff; }
.cft__btn--send:hover { background: var(--c-primary-dark); }
.cft__btn--open { background: var(--c-surface-4); color: var(--c-text-2); border: 1px solid var(--c-border); }
.cft__btn--open:hover { border-color: var(--c-border-hi); color: var(--c-text); }
.cft__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-3);
  padding: var(--s-1);
  flex-shrink: 0;
  border-radius: var(--r-full);
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cft__close:hover { color: var(--c-text); background: var(--c-surface-4); }

@media (max-width: 600px) {
  #chat-float-toast {
    bottom: 72px;
    right: var(--s-3);
    left: var(--s-3);
    width: auto;
    max-width: none;
  }
}

/* ─── Organigrama — árbol con conectores SVG ────────────
   Cada nivel es un <ul> flex EN UNA SOLA FILA (sin flex-wrap): si los hermanos
   envuelven a varias filas se ven idénticos a hijos reales anidados de otro
   nodo — ambigüedad real de jerarquía, no solo estética. Con muchos hermanos
   se resuelve con scroll horizontal (heredado del contenedor #org-tree-scroll),
   nunca reacomodando en filas. Los conectores son <line> SVG calculadas por
   drawOrgTreeConnectors() según la posición real de cada tarjeta en pantalla —
   ver computeOrgTreeConnectors() en app.js. */
.org-tree, .org-tree ul {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  list-style: none;
  min-width: max-content;
}
.org-tree { padding: var(--s-4) 0; width: 100%; position: relative; }
.org-tree ul { width: fit-content; padding-top: var(--s-6); }
.org-tree li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--s-3);
  margin-bottom: var(--s-4);
  z-index: 1;
}
.org-tree__card {
  cursor: pointer;
  text-align: center;
  min-width: 130px;
  max-width: 170px;
  border-radius: var(--r-lg);
  padding: var(--s-2) var(--s-3);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.org-tree__card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.org-tree__card--root { background: var(--c-primary); color: #fff; border: 2px solid var(--c-primary-600, #6c5ce7); }
.org-tree__card--child { background: var(--c-surface-2); border: 1px solid var(--c-border); }
.org-tree__avatar {
  border-radius: 50%;
  background: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--s-1);
  overflow: hidden;
  flex-shrink: 0;
}
.org-tree__name { font-weight: 600; font-size: var(--t-sm); line-height: 1.2; margin-bottom: 2px; overflow-wrap: break-word; }
.org-tree__position { font-size: var(--t-2xs); opacity: .75; }
.org-tree__department { font-size: var(--t-2xs); opacity: .6; }
.org-tree__role-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: var(--r-full);
  font-size: 10px;
  color: #fff;
}
