/* ============================================================
   INGSE Informes — sistema de diseño
   Dos temas: "Pergamino" (claro, por defecto) y "Site Radio"
   (oscuro, [data-theme="dark"]). Un acento, sin sombras blandas
   ni gradientes: bordes de 1-2px hacen el trabajo estructural.

   Variables con nombre "--ink"/"--paper" heredadas de cuando solo
   habia un tema oscuro: --ink = color de texto, --paper = fondo
   de pagina. Se mantienen los NOMBRES (se referencian inline en 2
   templates) pero ahora cada tema les da su propio valor.

   --pending/--ok/--info/--bad son los 4 colores de estado de una
   tarea (gris/azul/verde/rojo). --warn es OTRA cosa: el aviso de
   "registrar en nombre de otro" (admin), no tiene que ver con
   estados de tarea.
   ============================================================ */

:root {
  /* Neutro calido + ambar (claro) - paleta "stone" de Tailwind para los
     neutros, con dos tonos de ambar separados a proposito: --accent es
     brillante y SOLO se usa para rellenos con texto encima (botones,
     badges) que ya traen --accent-ink como contraste; --link es un
     ambar mas oscuro para texto/bordes que van DIRECTO sobre el fondo
     (enlaces, foco, anillos de seleccion), donde el ambar brillante no
     tiene contraste suficiente. */
  --ink: #1c1917;
  --ink-soft: #57534e;
  --ink-faint: #a8a29e;
  --paper: #fafaf9;
  --surface: #ffffff;
  --line: rgba(0, 0, 0, 0.07);
  --line-strong: #e7e5e4;
  --accent: #f5b83d;
  --accent-hover: #e0a530;
  --accent-ink: #1c1917;
  --accent-soft: #fdecc8;
  --link: #b45309;

  --ok: #15803d;
  --ok-soft: #dcf2e3;
  --info: #1d4ed8;
  --info-soft: #dbe7fe;
  --pending: #57534e;
  --pending-soft: #f5f5f4;
  --bad: #dc2626;
  --bad-soft: #fde2e1;
  --moved: #7c3aed;
  --moved-soft: #ede4fd;
  --blocked: #be185d;
  --blocked-soft: #fce7f0;

  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.1);

  --input-bg: #ffffff;
  --hover-bg: #f5f5f4;

  --radius-sm: 4px;
  --radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* la barra superior es oscura en los dos temas (ancla de marca):
     su texto NO usa --ink (que si cambia con el tema) */
  --topbar-text: #f2efea;
  --topbar-text-soft: #a8a8ac;
}

:root[data-theme="dark"] {
  /* Site Radio (oscuro) */
  --ink: #f2efea;
  --ink-soft: #a8a8ac;
  --ink-faint: #6e6e72;
  --paper: #1c1c1e;
  --surface: #242426;
  --line: #333335;
  --line-strong: #46464a;
  --accent: #f2b84b;
  --accent-hover: #d9a23a;
  --accent-ink: #1c1c1e;
  --accent-soft: #3a2f18;
  /* igual al --accent de este tema: en oscuro el ambar ya sirve bien
     como texto/borde directo sobre el fondo, no hace falta un segundo
     tono como en claro. */
  --link: #f2b84b;

  --ok: #34c78a;
  --ok-soft: #163826;
  --info: #5ba7f7;
  --info-soft: #1b2d42;
  --pending: #9c9a97;
  --pending-soft: #2e2c2a;
  --bad: #e0634a;
  --bad-soft: #3a1f18;
  --moved: #a98bf0;
  --moved-soft: #2c2440;
  --blocked: #f472b6;
  --blocked-soft: #3d1f2e;

  --warn: #e0a23d;
  --warn-soft: #3a2c14;

  --input-bg: #2a2a2c;
  --hover-bg: #2a2a2c;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--space-2); font-family: var(--font-heading); letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 500; }
h3 { font-size: 18px; font-weight: 500; }
p { margin: 0 0 var(--space-3); color: var(--ink-soft); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.num, .mono { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

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

/* ---------- layout ---------- */

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: #141415;
  color: var(--topbar-text);
  border-bottom: 3px solid var(--accent);
}
.topbar__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: 56px;
  flex-wrap: wrap;
}
.topbar__brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  color: var(--topbar-text);
  letter-spacing: -0.01em;
}
.topbar__brand:hover { text-decoration: none; opacity: 0.9; }
.topbar__nav { display: flex; align-items: center; gap: var(--space-4); margin-left: auto; flex-wrap: wrap; }
.topbar__nav a {
  color: var(--topbar-text-soft);
  font-size: 14px;
  font-weight: 500;
  padding: var(--space-1) 0;
  border-bottom: 2px solid transparent;
}
.topbar__nav a:hover { color: var(--topbar-text); text-decoration: none; }
.topbar__nav a.is-active { color: var(--topbar-text); border-bottom-color: var(--accent); }

.page {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-7);
  flex: 1;
}
.page--narrow { max-width: 520px; }

/* ---------- flash messages ---------- */

.flash {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-soft);
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.flash--success { border-left-color: var(--ok); }
.flash--danger { border-left-color: var(--bad); }
.flash button {
  background: none; border: none; color: var(--ink-faint); cursor: pointer; font-size: 18px;
  line-height: 1; padding: 0;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn.is-hidden { display: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--hover-bg); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: transparent; padding: 8px 10px; }
.btn-ghost:hover { color: var(--ink); background: var(--hover-bg); }
.btn-danger-line { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger-line:hover { background: var(--bad-soft); }
.btn-ok-line { background: transparent; color: var(--ok); border-color: var(--ok); }
.btn-ok-line:hover { background: var(--ok-soft); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* ---------- cards / panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel__head {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.panel__head h2, .panel__head h3 { margin: 0; }
.panel__body { padding: var(--space-5); }
.panel__body--flush { padding: 0; }

/* ---------- forms ---------- */

label, .field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: var(--space-1);
}
.field { margin-bottom: var(--space-4); }
.field-aviso { font-size: 12.5px; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.field-aviso.is-hidden { display: none; }
.field-error { font-size: 12.5px; color: var(--bad); background: var(--bad-soft); border: 1px solid var(--bad); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.field-error.is-hidden { display: none; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=month], textarea, select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--link);
  outline-offset: -1px;
  border-color: var(--link);
}
input[readonly] { background: var(--paper); color: var(--ink-soft); }
textarea { resize: vertical; min-height: 80px; font-family: var(--font-sans); }
.field-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 140px; }
.help { font-size: 12px; color: var(--ink-faint); margin-top: var(--space-1); }

/* ---------- badges / status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--pending { background: var(--pending-soft); color: var(--pending); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--moved { background: var(--moved-soft); color: var(--moved); }
.badge--blocked { background: var(--blocked-soft); color: var(--blocked); }
.badge--neutral { background: var(--line); color: var(--ink-soft); }
.badge--role { background: #141415; color: #fff; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 2px 1px 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--link);
  white-space: nowrap;
}
.tag-chip__quitar {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--link);
  opacity: 0.6;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  border-radius: 50%;
}
.tag-chip__quitar:hover { background: var(--bad-soft); color: var(--bad); opacity: 1; }

/* ---------- archivos (panel de detalle de actividad) ---------- */

.archivo-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--space-3); }
.archivo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-2);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
}
.archivo-card:hover, .archivo-card:focus-visible { border-color: var(--line-strong); outline: none; }
.archivo-card__thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.archivo-card__thumb { width: 100%; height: 100%; object-fit: cover; }
.archivo-card__icono { color: var(--ink-faint); }
/* etiqueta con la extension, sobrepuesta abajo del icono generico - mismos
   4 colores de estado que ya usa la app, reutilizados aqui solo para
   distinguir tipos de archivo de un vistazo (nada que ver con estados). */
.archivo-card__badge {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 3px;
  color: #fff;
}
.archivo-card__badge--pdf { background: var(--bad); }
.archivo-card__badge--doc { background: var(--info); }
.archivo-card__badge--xls { background: var(--ok); }
.archivo-card__badge--ppt { background: var(--warn); }
.archivo-card__badge--csv { background: var(--moved); }
.archivo-card__badge--txt { background: var(--pending); }
.archivo-card__nombre { font-size: 11px; color: var(--ink-soft); text-align: center; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archivo-card--seleccionable { width: 100%; }
.archivo-card.is-selected { border-color: var(--link); background: var(--accent-soft); }
/* lupa de vista previa: sobrepuesta en la esquina del icono, solo visible
   al pasar el mouse (o con foco por teclado) para no competir con el
   icono/badge del tipo de archivo en reposo. */
.archivo-card__preview-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.archivo-card:hover .archivo-card__preview-btn,
.archivo-card:focus-within .archivo-card__preview-btn,
.archivo-card__preview-btn:focus-visible {
  opacity: 1;
}
.archivo-card__preview-btn:hover { background: rgba(0, 0, 0, 0.75); }

/* ---------- explorador de archivos del editor de descripcion ---------- */

/* dialog.kanban-dialog.archivo-explorador (las dos clases, no solo una)
   para que esta regla gane por especificidad sobre dialog.kanban-dialog
   (max-width: 480px) sin importar el orden entre ambas en el archivo -
   con la misma especificidad gana la ultima en el CSS, algo fragil que ya
   nos mordio una vez con el "display" de abajo. */
dialog.kanban-dialog.archivo-explorador { max-width: 900px; width: 92vw; padding: 0; }
/* el "display: flex" solo puede aplicar cuando el dialog esta [open]: sin
   este guard pisa el "display: none" nativo que el navegador le pone a un
   <dialog> cerrado (misma especificidad, pero una regla de autor siempre
   gana sobre la hoja de estilos del user agent) y el modal queda visible
   para siempre aunque .close() si se haya llamado. */
dialog.kanban-dialog.archivo-explorador[open] { display: flex; flex-direction: column; }
.archivo-explorador__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.archivo-explorador__head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.archivo-dialog__boton {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.archivo-dialog__boton:hover { background: var(--hover-bg); border-color: var(--line-strong); color: var(--ink); }

.archivo-explorador__barra { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.archivo-explorador__buscador {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  padding: 0 var(--space-2);
}
.archivo-explorador__buscador input { flex: 1; min-width: 0; border: none; background: transparent; padding: 8px 4px; font-size: 13px; color: var(--ink); outline: none; }
.archivo-explorador__buscador button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.archivo-explorador__buscador button:hover { background: var(--hover-bg); color: var(--ink); }
.archivo-explorador__sugerencias {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  z-index: 10;
}
.archivo-explorador__sugerencias.is-hidden { display: none; }
/* .archivo-explorador__sugerencias .archivo-explorador__sugerencia (dos
   clases, no una) para ganarle por especificidad a ".archivo-explorador__
   buscador button" de arriba - con una sola clase, esa regla de "button"
   (clase+elemento) le gana y deja cada sugerencia encogida a 28x28px como
   los botones de icono del buscador, sin importar el orden en el archivo. */
.archivo-explorador__sugerencias .archivo-explorador__sugerencia {
  display: block;
  width: 100%;
  height: auto;
  text-align: left;
  border: none;
  background: transparent;
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}
.archivo-explorador__sugerencias .archivo-explorador__sugerencia:hover { background: var(--hover-bg); }

/* boton "Subir nuevo": mismo tamano/forma que el boton de filtros, vive
   entre el buscador y los filtros en la barra del explorador. */
.archivo-explorador__subir-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.archivo-explorador__subir-btn:hover { background: var(--hover-bg); }

.archivo-explorador__filtro { position: relative; flex-shrink: 0; }
.archivo-explorador__filtro-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.archivo-explorador__filtro-trigger:hover { background: var(--hover-bg); }
.archivo-explorador__filtro-trigger.is-activo { border-color: var(--link); color: var(--link); }
/* mismo patron de "badge de notificacion" que act-filtros-trigger__badge
   (ver listado de Actividades) - contador sobrepuesto en la esquina del
   icono. */
.archivo-explorador__filtro-icon { position: relative; display: inline-flex; }
.archivo-explorador__filtro-trigger__badge {
  position: absolute;
  top: -4px;
  right: -6px;
  transform: translate(50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--surface);
}
.archivo-explorador__filtro-trigger__badge.is-hidden { display: none; }
.archivo-explorador__filtro-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: var(--space-3);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.archivo-explorador__filtro-panel.is-hidden { display: none; }
.archivo-explorador__filtro-campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-soft); flex: 1; min-width: 0; }
.archivo-explorador__filtro-campo select, .archivo-explorador__filtro-campo input { font-size: 13px; min-width: 0; width: 100%; }
.archivo-explorador__filtro-fechas { display: flex; gap: var(--space-2); }
.archivo-explorador__filtro-fechas input[type=date] { flex: 1; min-width: 0; }
.archivo-explorador__filtro-acciones { display: flex; justify-content: flex-end; gap: var(--space-2); }
.archivo-explorador__filtro-label { font-size: 12px; color: var(--ink-soft); }

/* "Creador": mismo patron del abanico de responsables (boton + panel
   desplegable con checkboxes y su propio "Guardar") en vez de un <select>
   simple, para permitir varios a la vez. */
.archivo-explorador__filtro-creador-wrap { position: relative; }
.archivo-explorador__filtro-creador-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  padding: 0 var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.archivo-explorador__filtro-creador-trigger:hover { background: var(--hover-bg); }
.archivo-explorador__filtro-creador-trigger span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archivo-explorador__filtro-creador-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  z-index: 25;
  display: flex;
  flex-direction: column;
}
.archivo-explorador__filtro-creador-panel.is-hidden { display: none; }
/* la lista/items/boton de adentro reutilizan .resp-fan__panel-lista,
   .resp-fan__panel-item y .resp-fan__panel-guardar (mismo formato pedido:
   "igual que escoger responsables de la actividad"). */

.archivo-explorador__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
  min-height: 320px;
}
.archivo-explorador__vacio { grid-column: 1 / -1; color: var(--ink-faint); font-size: 13px; text-align: center; padding: var(--space-5) 0; }

.archivo-explorador__paginacion { display: flex; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft); }
.archivo-explorador__paginacion button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.archivo-explorador__paginacion button:hover:not(:disabled) { background: var(--hover-bg); }
.archivo-explorador__paginacion button:disabled { opacity: 0.4; cursor: default; }

.archivo-explorador__pie { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
.archivo-explorador__pie-acciones { display: flex; gap: var(--space-2); margin-left: auto; }

/* ---------- preview de un archivo de la libreria (desde la lupa de cada
   tarjeta del explorador) ---------- */
/* SIN position:relative aca - el <dialog> ya trae position:fixed por
   default del user agent (lo que lo centra en el VIEWPORT sin importar el
   scroll de la pagina de atras, y de paso sirve de containing block para
   los hijos position:absolute de adentro, como el panel de info). Pisarlo
   con "relative" rompe las dos cosas: el dialog deja de comportarse como
   fixed y el navegador termina llevando el scroll de la pagina al tope al
   abrirlo. */
dialog.kanban-dialog.archivo-preview-lib { max-width: 720px; width: 88vw; padding: 0; }
dialog.kanban-dialog.archivo-preview-lib[open] { display: flex; flex-direction: column; }
.archivo-preview-lib__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.archivo-preview-lib__head h3 { margin: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archivo-preview-lib__acciones { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
/* info del archivo: se activa con hover, sin click - el boton no tiene
   su propio estado "abierto", el panel aparece con :hover (del icono o
   del panel mismo, para poder entrar el mouse a leerlo) y desaparece en
   cuanto el mouse sale de los dos. */
.archivo-preview-lib__info-wrap { position: relative; display: inline-flex; }
.archivo-preview-lib__info-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 260px;
  background: var(--accent-soft);
  border: 1px solid var(--link);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: var(--space-3);
  z-index: 30;
  font-size: 12.5px;
  color: var(--ink);
}
.archivo-preview-lib__info-wrap:hover .archivo-preview-lib__info-panel,
.archivo-preview-lib__info-panel:hover {
  display: block;
}
.archivo-preview-lib__info-panel dt { color: var(--link); margin-top: var(--space-2); }
.archivo-preview-lib__info-panel dt:first-child { margin-top: 0; }
.archivo-preview-lib__info-panel dd { margin: 0; font-weight: 500; color: var(--ink); overflow-wrap: break-word; }
.archivo-preview-lib__cuerpo {
  flex: 1;
  min-height: 320px;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow: auto;
}
.archivo-preview-lib__cuerpo iframe { width: 100%; height: 65vh; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.archivo-preview-lib__cuerpo img { max-width: 100%; max-height: 65vh; border-radius: var(--radius-sm); }
.archivo-preview-lib__cuerpo pre { width: 100%; max-height: 65vh; overflow: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.archivo-preview-lib__vacio { color: var(--ink-faint); font-size: 13px; text-align: center; }
.archivo-preview-lib__copiado {
  position: absolute;
  bottom: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}
.archivo-preview-lib__copiado.is-hidden { display: none; }

/* ---------- descripcion con formato (Markdown -> HTML ya saneado en el
   servidor, ver markdown_render.py) ---------- */

.descripcion-render { font-size: 14px; line-height: 1.6; color: var(--ink); }
.descripcion-render p { margin: 0 0 var(--space-3); }
.descripcion-render p:last-child { margin-bottom: 0; }
.descripcion-render ul, .descripcion-render ol { margin: 0 0 var(--space-3); padding-left: 1.4em; }
.descripcion-render img { max-width: 100%; border-radius: var(--radius-sm); display: block; margin: var(--space-2) 0; }
.descripcion-render a { color: var(--link); }
.descripcion-render code { background: rgba(245, 184, 61, 0.18); padding: 1px 5px; border-radius: 3px; font-size: 0.92em; }
.descripcion-render pre { background: var(--hover-bg); padding: var(--space-3); border-radius: var(--radius-sm); overflow-x: auto; }
.descripcion-render pre code { background: none; padding: 0; }
.descripcion-render blockquote { margin: 0 0 var(--space-3); padding-left: var(--space-3); border-left: 3px solid var(--link); color: var(--ink-soft); }
:root[data-theme="dark"] .descripcion-render code { background: rgba(242, 184, 75, 0.16); }
.descripcion-render li.task-list-item { list-style: none; margin-left: -1.4em; }
/* Checkbox dibujado a mano (en vez de accent-color): el relleno nativo
   del checkbox via accent-color sale gris/apagado en varios navegadores
   y no se distingue del tilde. Con appearance:none se controla relleno
   y tilde por separado, usando el mismo par --accent/--accent-ink que
   ya se usa en los botones primarios (diseñado para contrastar). */
.descripcion-render li.task-list-item input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  cursor: default;
  position: relative;
}
.descripcion-render li.task-list-item input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.descripcion-render li.task-list-item input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* titulos H1-H3 colapsables: pestanita/chevron al lado que oculta todo
   el contenido de esa seccion (ver envolverSeccionesColapsables en
   detalle_actividad.js, que arma .descripcion-section__body agrupando
   los hermanos hasta el siguiente heading del mismo nivel o mayor). H4-H6
   no llevan boton, solo cambian de tamano como manda el estandar. */
.descripcion-render h1, .descripcion-render h2, .descripcion-render h3 {
  display: flex;
  align-items: center;
  gap: 6px;
}
.descripcion-heading__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-sm);
}
.descripcion-heading__toggle:hover { color: var(--link); background: var(--hover-bg); }
.descripcion-heading__toggle svg { transition: transform 0.15s; }
.descripcion-heading__toggle.is-colapsado svg { transform: rotate(-90deg); }
.descripcion-section__body.is-hidden { display: none; }

/* lupa sobre una imagen de la descripcion renderizada: mismo espiritu que
   la del explorador de archivos, visible solo al pasar el mouse. */
/* inline-block (no block): el wrap se encoge al tamano REAL con el que
   termina renderizando la imagen (que puede ser mas angosta que el
   contenedor), para que el boton-ojo, posicionado relativo a este wrap,
   quede pegado a la esquina de la imagen y no flotando en el espacio
   vacio a la derecha de una imagen angosta. */
.descripcion-img-wrap { position: relative; display: inline-block; max-width: 100%; margin: var(--space-2) 0; }
.descripcion-img-wrap img { margin: 0; }
.descripcion-img-wrap__preview-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.descripcion-img-wrap:hover .descripcion-img-wrap__preview-btn,
.descripcion-img-wrap__preview-btn:focus-visible {
  opacity: 1;
}
.descripcion-img-wrap__preview-btn:hover { background: rgba(0, 0, 0, 0.75); }

/* ---------- descripcion: bloque "vista/editar" estilo descripcion de un
   PR de GitHub - una tarjeta con encabezado ("Descripcion" + menu "...")
   y un cuerpo que alterna entre la vista renderizada (por defecto, sin
   fondo propio, con el texto en --ink para que contraste en los dos
   temas) y el editor con pestanas Escribir (textarea plano, sin formato
   en vivo a proposito) / Vista previa. ---------- */

.descripcion-bloque {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  /* SIN overflow:hidden: eso recortaba el dropdown de "..." (ver
     .descripcion-menu__panel) contra el alto de este contenedor - con
     secciones colapsadas el contenedor se queda chico y el menu quedaba
     parcial o totalmente invisible. Las esquinas redondeadas de arriba
     las resuelve el border-radius propio de .descripcion-cabecera de
     abajo, no hace falta recortar para lograr lo mismo. */
}
.descripcion-cabecera {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.descripcion-cabecera__titulo { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.descripcion-cuerpo { padding: var(--space-3); }

.descripcion-vista.is-hidden { display: none; }
#descripcion-vacia.is-hidden { display: none; }

.descripcion-menu__trigger {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
}
.descripcion-menu__trigger:hover { background: var(--hover-bg); border-color: var(--line-strong); color: var(--ink); }
.descripcion-menu__panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: var(--space-3);
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2);
  z-index: 10;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}
.descripcion-menu__panel.is-open { display: block; }
.descripcion-menu__panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2);
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.descripcion-menu__panel button:hover { background: var(--hover-bg); }

.descripcion-editor.is-hidden { display: none; }
.descripcion-editor {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.descripcion-editor__barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.descripcion-editor__tabs { display: flex; gap: var(--space-1); }
.descripcion-editor__tab {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.descripcion-editor__tab:hover { color: var(--ink); }
.descripcion-editor__tab.is-active { color: var(--ink); background: var(--paper); }
.descripcion-editor__toolbar { display: flex; align-items: center; gap: 2px; }
.descripcion-editor__toolbar.is-hidden { visibility: hidden; }
.descripcion-toolbar__sep { width: 1px; height: 16px; background: var(--line-strong); margin: 0 4px; }
.descripcion-toolbar-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}
.descripcion-toolbar-btn:hover { background: var(--hover-bg); border-color: var(--line-strong); color: var(--ink); }
#descripcion-textarea {
  display: block;
  width: 100%;
  min-height: 320px;
  padding: var(--space-3);
  border: none;
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}
#descripcion-textarea:focus { outline: none; }
#descripcion-textarea.is-hidden { display: none; }
.descripcion-editor__preview { min-height: 320px; padding: var(--space-3); background: var(--paper); }
.descripcion-editor__preview.is-hidden { display: none; }
.descripcion-editor__acciones {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
#descripcion-error.is-hidden { display: none; }

/* ---------- header de la actividad: ahora solo trae el id (izquierda) y
   las acciones (estado + compartir, derecha) - el titulo se movio al
   body, a la fila de abanico/prioridad (ver .tarea-meta-row). ---------- */

.panel__head--tarea { align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: nowrap; }
.tarea-id { font-size: 13px; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tarea-header-acciones { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; }
.tarea-compartir-wrap { position: relative; display: inline-flex; }
.tarea-compartir-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.tarea-compartir-btn:hover { background: var(--hover-bg); border-color: var(--line-strong); color: var(--ink); }
.tarea-compartir-copiado {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  white-space: nowrap;
  background: var(--ink);
  color: var(--paper);
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 999px;
  z-index: 10;
}
.tarea-compartir-copiado.is-hidden { display: none; }

/* titulo + abanico/prioridad comparten fila, titulo a la izquierda,
   abanico+prioridad agrupados a la derecha. */
/* la fila nunca se parte en dos (flex-wrap: nowrap) - si el titulo es muy
   largo, crece HACIA ABAJO dentro de su propia columna (el texto del h2
   envuelve solo, como cualquier texto normal) en vez de empujar el
   abanico/prioridad a una fila aparte; esos dos siempre se quedan
   pegados a la derecha, con su ancho propio sin encogerse. */
.tarea-meta-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: nowrap; }
.tarea-titulo-col { flex: 1 1 auto; min-width: 0; }
.tarea-meta-row__right { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); flex: 0 0 auto; }
.tarea-fan-col { display: flex; }

/* ---------- tags (debajo del abanico de responsables y el selector de
   prioridad, alineado a la derecha): los chips ya agregados quedan a la
   IZQUIERDA del botón de tags (un tag nuevo entra pegado al boton, no al
   otro extremo) - .tags-row__chips usa display:contents para que cada
   chip sea un item mas del flex de .tags-row, en vez de quedar en su
   propia caja aparte. ---------- */
.tags-row { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.tags-row__chips { display: contents; }
.tags-control { position: relative; display: flex; flex-shrink: 0; }
/* sin contorno ni fondo - solo el icono, que se pinta de amarillo al
   pasar el mouse, con foco de teclado, o mientras el dropdown esta
   abierto (pedido explicito: "sin un contorno de circulo"). */
.tags-control__trigger {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.tags-control__trigger:hover,
.tags-control__trigger:focus-visible,
.tags-control__trigger.is-open { color: var(--link); }
.tags-control__panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 20;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: var(--space-2);
  gap: var(--space-2);
}
.tags-control__panel.is-open { display: flex; }
.tags-control__buscar { font-size: 13px; padding: 7px 10px; }
.tags-control__lista { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.tags-control__item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: var(--space-2);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.tags-control__item:hover { background: var(--hover-bg); }
.tags-control__vacio { font-size: 12.5px; color: var(--ink-faint); padding: var(--space-2); }
.tags-control__crear {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2);
  cursor: pointer;
}
.tags-control__crear:hover { background: var(--accent-hover); }
.tags-control__crear.is-hidden { display: none; }

.tarea-titulo__texto {
  margin: 0;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: var(--radius-sm);
  word-break: break-word;
}
.tarea-titulo__texto.is-editable { cursor: pointer; }
.tarea-titulo__texto.is-editable:hover { background: var(--hover-bg); }
.tarea-titulo__texto.is-hidden { display: none; }
.tarea-titulo__campo.is-hidden { display: none; }
#tarea-titulo-error.is-hidden { display: none; }

/* ---------- abanico de responsables (header) ---------- */

.resp-fan__avatares { display: flex; align-items: center; }
.resp-fan__avatar { position: relative; margin-left: -4.5px; line-height: 0; }
.resp-fan__avatar:first-child { margin-left: 0; }
.resp-fan__avatar .avatar { width: 30px; height: 30px; font-size: 12.5px; box-shadow: 0 0 0 2px var(--surface); }
.resp-fan__tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
  pointer-events: none;
  z-index: 30;
}
.resp-fan__avatar:hover .resp-fan__tooltip { opacity: 1; visibility: visible; }
.resp-fan__agregar-wrap { position: relative; margin-left: -4.5px; line-height: 0; display: inline-block; }
.resp-fan__agregar {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-faint);
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--surface);
}
.resp-fan__agregar:hover { border-color: var(--link); color: var(--link); }
.resp-fan__panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 20;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.resp-fan__panel.is-open { display: flex; }
.resp-fan__panel-lista { overflow-y: auto; max-height: 220px; padding: var(--space-2); }
.resp-fan__panel-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.resp-fan__panel-item:hover { background: var(--hover-bg); }
.resp-fan__panel-item input { width: auto; margin: 0; }
.resp-fan__panel-item.is-disabled { opacity: 0.45; cursor: not-allowed; }
.resp-fan__panel-aviso {
  font-size: 11.5px;
  color: var(--warn);
  padding: 0 var(--space-2) var(--space-2);
}
.resp-fan__panel-aviso.is-hidden { display: none; }
.resp-fan__panel-guardar {
  border: none;
  border-top: 1px solid var(--line);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2);
  cursor: pointer;
  border-radius: 0 0 var(--radius) var(--radius);
}
.resp-fan__panel-guardar:hover:not(:disabled) { background: var(--accent-hover); }
.resp-fan__panel-guardar:disabled { background: var(--hover-bg); color: var(--ink-faint); cursor: not-allowed; }

/* ---------- estado (header): boton con el subestado propio, que
   despliega las transiciones permitidas en formato de pastilla de color
   - reemplaza al viejo panel "Tu avance". ---------- */

.estado-control { position: relative; }
.estado-boton { border: none; cursor: pointer; font-family: inherit; border-radius: var(--radius-sm); padding: 6px 12px; }
.estado-boton--estatica { cursor: default; }
.estado-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2);
  z-index: 20;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.estado-panel.is-open { display: block; }
.estado-panel__item {
  display: flex;
  width: 100%;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: var(--space-1);
}
.estado-panel__item:last-of-type { margin-bottom: 0; }
.estado-panel__item:hover { opacity: 0.85; }
.estado-panel__item.is-active { border-color: currentColor; }
.estado-panel__horas { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.estado-panel__horas.is-hidden { display: none; }
#estado-hora-aviso.is-hidden { display: none; }
#estado-hora-inicio-wrap.is-hidden { display: none; }
#estado-hora-fin-wrap.is-hidden { display: none; }
#estado-hora-error.is-hidden { display: none; }

/* ---------- prioridad (primera fila del cuerpo, junto al abanico):
   mismo patron de boton/dropdown que estado, pero con fondo neutro - el
   color viene del icono y el texto, uno por nivel, no de un relleno. */

.prioridad-control { position: relative; }
.prioridad-boton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.prioridad-boton:hover { background: var(--hover-bg); }
.prioridad-boton--estatica { cursor: default; }
.prioridad-boton--estatica:hover { background: var(--surface); }
.prioridad-boton__chevron { margin-left: 2px; color: var(--ink-faint); }
.prioridad-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2);
  z-index: 20;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.prioridad-panel.is-open { display: block; }
.prioridad-panel__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
}
.prioridad-panel__item:hover { background: var(--hover-bg); }
.prioridad-boton { color: var(--ink); }

/* El color de cada nivel vive SOLO en el icono, no en el texto (que usa
   --ink de siempre, legible en los dos temas). El icono ademas vive
   dentro de un cuadrado redondeado con su propio fondo fijo (no ligado a
   --surface/--paper): es lo que lo hace visible siempre, sin importar si
   la tarjeta esta en modo claro u oscuro - Baja (icono oscuro) lleva
   fondo claro, Muy baja (icono clarito) lleva fondo oscuro, y los tres
   del medio (ya tienen brillo intermedio) llevan un fondo suave del
   mismo tono para que las 5 se sientan parte de un mismo set. */
.prioridad-icono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
}
.prioridad-icono--critico { background: #ec4b4b; color: #fdeae6; }
.prioridad-icono--alta { background: #fdeae6; color: #f4857b; }
.prioridad-icono--media { background: #f6e8d0; color: #b8790f; }
.prioridad-icono--baja { background: #e3e9fb; color: #1e2f78; }
.prioridad-icono--muy-baja { background: #1c2b4a; color: #a9ccf5; }

/* ---------- Interaccion: pestanas estilo carpeta/navegador - la activa
   sobresale del borde superior del contenido y se "funde" con el (mismo
   fondo, sin borde inferior propio), como una pestana de Chrome; la
   inactiva queda separada, con su propio borde completo. ---------- */
.interaccion-tabs-wrap { padding: var(--space-4) var(--space-5) var(--space-5); }
.interaccion-tabs { display: flex; gap: 4px; position: relative; z-index: 2; margin-bottom: -1px; }
.interaccion-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--paper);
  color: var(--ink-faint);
  cursor: pointer;
}
.interaccion-tab:hover { color: var(--ink); }
.interaccion-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  border-bottom-color: var(--surface);
}
.interaccion-contenido {
  border: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  background: var(--surface);
  position: relative;
  z-index: 1;
  padding: var(--space-5);
}
/* .is-hidden no es una clase global en este proyecto (se define por
   componente) - sin esta regla, #tab-comentarios/#tab-historial quedaban
   SIEMPRE visibles los dos a la vez, sin importar que la clase si se
   estuviera alternando bien por JS. */
.interaccion-contenido > .is-hidden { display: none; }

/* ---------- responsables + tiempo trabajado (fusionado, agrupado por
   persona) ---------- */

.movimientos-titulo { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: var(--space-3); }
.resp-tiempo-lista { display: flex; flex-direction: column; }
.resp-tiempo-item { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.resp-tiempo-item:first-child { padding-top: 0; }
.resp-tiempo-item:last-child { border-bottom: none; padding-bottom: 0; }
.resp-tiempo-item__cabeza { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.resp-tiempo-item__nombre { font-weight: 600; flex: 1; }
.resp-tiempo-item__vacio { margin: 0; }

/* ---------- comentarios ---------- */

.comentarios-lista {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
/* contenedor propio por comentario (antes no tenian borde ni fondo, se
   leian todos corridos uno detras de otro) - mismo patron visual que
   .resp-tiempo-item pero como tarjeta individual en vez de fila de tabla. */
.comentario {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.comentario__cuerpo { flex: 1; min-width: 0; }
.comentario__cabeza { display: flex; align-items: center; gap: var(--space-2); margin-bottom: 2px; }
.comentario__autor { font-size: 13px; font-weight: 600; }
.comentario__hora { font-size: 12px; color: var(--ink-faint); flex: 1; min-width: 0; }
.comentario__editar-btn, .comentario__borrar-btn, .comentario__cancelar-btn {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.comentario__editar-btn:hover, .comentario__cancelar-btn:hover { color: var(--ink); text-decoration: underline; }
.comentario__borrar-btn:hover { color: var(--bad); text-decoration: underline; }
.comentario__borrar-form { display: inline-flex; margin: 0; }
/* contenido ya viene renderizado (markdown -> html, ver render_descripcion
   en el server) - sin white-space:pre-wrap, eso era de cuando esto era
   texto plano escapado y los saltos de linea no tenian otra forma de
   respetarse. */
.comentario__texto { font-size: 13.5px; margin: 0; }
.comentario__editar-form { margin-top: var(--space-2); }
.comentario__editar-form.is-hidden, .comentario__texto.is-hidden, .comentario__editar-btn.is-hidden { display: none; }
/* margin-top propio en vez de depender del "mb-3" del contenedor de
   arriba (esa clase utilitaria no existe en el CSS - el campo quedaba
   pegado al ultimo comentario sin ningun espacio real entre los dos). */
.comentario-nuevo { margin-top: var(--space-4); }

/* ---------- editor Markdown de comentarios (nuevo + editar): misma pinta
   que el editor de descripcion (.descripcion-editor, .descripcion-editor__*
   y .descripcion-toolbar__sep ya cubren el marco/barra/preview - se
   reusan tal cual), pero con botones/pestanas en clases propias
   (comentario-*) para no disparar los listeners globales de
   detalle_actividad.js que ya escuchan .descripcion-toolbar-btn y
   .descripcion-editor__tab en todo el documento. ---------- */
.comentario-toolbar-btn, .comentario-editor__tab { cursor: pointer; }
.comentario-toolbar-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
}
.comentario-toolbar-btn:hover { background: var(--hover-bg); border-color: var(--line-strong); color: var(--ink); }
.comentario-editor__tab {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}
.comentario-editor__tab:hover { color: var(--ink); }
.comentario-editor__tab.is-active { color: var(--ink); background: var(--paper); }
.comentario-md-textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  padding: var(--space-3);
  border: none;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}
.comentario-md-textarea:focus { outline: none; }
.comentario-md-textarea.is-hidden { display: none; }
.comentario-md-editor .descripcion-editor__preview { min-height: 180px; }
.comentario-md-editor .descripcion-editor__preview.is-hidden { display: none; }
.comentario-md-editor .descripcion-editor__toolbar.is-hidden { visibility: hidden; }

/* ---------- caja de "nuevo comentario": colapsada por defecto (sin la
   barra/toolbar a la vista) - se expande al modo Escribir recien cuando
   el usuario hace click adentro, igual patron que el titulo de la tarea
   (tarea-titulo__texto.is-editable). ---------- */
.comentario-nuevo__colapsado {
  padding: var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-faint);
  font-size: 13.5px;
  cursor: pointer;
}
.comentario-nuevo__colapsado:hover { background: var(--hover-bg); }
.comentario-nuevo__colapsado.is-hidden { display: none; }
.comentario-nuevo__expandido.is-hidden { display: none; }
/* Cancelar/Guardar-Comentar de los editores de comentario: a la derecha,
   mismos botones (.btn.btn-ghost/.btn-primary) que el par Cancelar/
   Guardar cambios de la descripcion. */
.comentario-acciones { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* ---------- reacciones con emoji (por comentario) ---------- */

.comentario__reacciones { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--space-2); }
.reaccion-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
}
.reaccion-chip:hover { border-color: var(--link); background: var(--accent-soft); }
.reaccion-chip.is-mia { border-color: var(--link); background: var(--accent-soft); color: var(--link); }
.reaccion-chip__count { font-weight: 600; color: var(--ink-soft); }
.reaccion-chip.is-mia .reaccion-chip__count { color: var(--link); }
/* tooltip propio en vez de "title" nativo (ese tarda, y a veces el
   navegador no lo muestra) - mismo patron que .act-avatar-tooltip del
   abanico de filtro de Actividades. */
.reaccion-chip__tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
  pointer-events: none;
  z-index: 30;
}
.reaccion-chip:hover .reaccion-chip__tooltip { opacity: 1; visibility: visible; }

.reaccion-agregar-wrap { position: relative; display: inline-flex; }
.reaccion-agregar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-faint);
  cursor: pointer;
}
.reaccion-agregar-btn:hover { border-color: var(--link); color: var(--link); }
.reaccion-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  z-index: 10;
}
.reaccion-picker.is-open { display: flex; }
.reaccion-picker__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 16px;
  cursor: pointer;
}
.reaccion-picker__item:hover { background: var(--hover-bg); }

/* ---------- tables ---------- */

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 12px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.tbl td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  overflow-wrap: break-word;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--hover-bg); }
.tbl-empty { text-align: center; color: var(--ink-faint); padding: var(--space-6) !important; }
.row-muted td { color: var(--ink-faint); }
.tbl-row-link { cursor: pointer; }
.tbl-prioridad { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tbl-prioridad .prioridad-icono { width: 18px; height: 18px; }

/* ---------- listado de actividades ---------- */

.act-paginacion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: 1px solid var(--line);
}
.act-paginacion__tamano { display: flex; align-items: center; gap: var(--space-2); }
.act-paginacion__tamano .btn.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.act-paginacion__nav { display: flex; align-items: center; gap: var(--space-3); }

/* una sola fila: buscador 80% + avatares 15% + filtros 5% - los tres a la
   misma altura compacta del boton de Filtros (no la altura por defecto,
   mas alta, de un input de texto comun). El ancho de los triggers no
   afecta el ancho de sus propios menus desplegables, que quedan con su
   medida fija de siempre. */
.act-fila-busqueda { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-3); }

.act-buscar-wrap { position: relative; flex: 80 1 0; min-width: 0; }
.act-buscar { width: 100%; padding: 6px 30px 6px 12px; font-size: 13px; }
.act-buscar-icono { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }

/* abanico de avatares: sin fondo/borde de boton, solo los circulos
   superpuestos - el seleccionado se marca con un anillo del color de
   acento del tema (no un boton "apretado"). */
.act-avatares-wrap { position: relative; flex: 15 1 0; min-width: 180px; display: flex; align-items: center; }
.act-avatares { display: flex; align-items: center; }
/* diametro fijo de 30px, cada uno tapa solo un 15% del diametro del
   anterior (30*0.15 = 4.5px de solape). Cada circulo necesita su propio
   z-index (puesto inline por JS, decreciente de izquierda a derecha,
   con el "+N" hasta abajo de todos) y position:relative para que el
   z-index aplique, para que el de la izquierda siempre quede ENCIMA
   del siguiente - incluido su anillo de seleccion, que por el spread
   del box-shadow sobresale un poco del circulo y si no se fuerza el
   z-index puede asomar por encima del avatar siguiente en vez de
   quedar tapado por el. */
.act-avatar-toggle {
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
  margin-left: -4.5px;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
}
.act-avatar-toggle:first-child { margin-left: 0; }
.act-avatar-toggle .avatar { width: 30px; height: 30px; font-size: 12.5px; box-shadow: 0 0 0 2px var(--paper); transition: box-shadow 0.12s; }
.act-avatar-toggle.is-selected .avatar { box-shadow: 0 0 0 2px var(--link); }
.act-avatar-mas .avatar, .act-avatar-mas { background: var(--line); color: var(--ink-soft); }
.act-avatar-mas {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--paper);
}
.act-avatar-mas.is-selected { box-shadow: 0 0 0 2px var(--link); }
/* tooltip con el nombre: centrado respecto al circulo del avatar,
   debajo de el. z-index alto fijo (no el inline/decreciente del
   avatar) para que no quede tapado por avatares vecinos con mayor
   z-index. */
.act-avatar-tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
  pointer-events: none;
  z-index: 30;
}
.act-avatar-toggle:hover .act-avatar-tooltip { opacity: 1; visibility: visible; }
.act-avatares-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  max-height: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 20;
  display: none;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.act-avatares-panel.is-open { display: flex; }
.act-avatares-panel__lista { overflow-y: auto; max-height: 210px; padding: var(--space-2); }
.act-avatares-panel__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.act-avatares-panel__item:hover { background: var(--hover-bg); }
.act-avatares-panel__item input { width: auto; margin: 0; }
.act-avatares-panel__limpiar {
  border: none;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  padding: var(--space-2);
  cursor: pointer;
  border-radius: 0 0 var(--radius) var(--radius);
}
.act-avatares-panel__limpiar:hover { background: var(--hover-bg); color: var(--ink); }

/* boton de filtros: sin recuadro visible hasta que se le pasa el mouse,
   para que no compita visualmente con el buscador y los avatares. */
.act-filtros-popover { position: relative; flex: 5 1 0; min-width: 32px; }
.act-filtros-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  width: 100%;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.act-filtros-trigger:hover { background: var(--hover-bg); border-color: var(--line-strong); color: var(--ink); }
/* el badge cuelga del icono (16x16), no del boton completo, para que
   quede pegado a su esquina y no "flotando" lejos de el dentro del
   padding del boton. */
.act-filtros-icon { position: relative; display: inline-flex; }
/* contador tipo "badge de notificacion": un circulo sobrepuesto en la
   esquina superior derecha del icono, con la mitad adentro y la mitad
   afuera (centrado exactamente en la esquina via transform). */
.act-filtros-trigger__badge {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--paper);
}
.act-filtros-trigger__badge.is-hidden { display: none; }
.act-filtros-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  z-index: 20;
  display: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.act-filtros-panel.is-open { display: block; }
.act-filtro-fecha { margin-bottom: var(--space-4); }
.act-filtro-fecha__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.act-filtro-fecha__label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.act-filtro-fecha__rango { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-faint); cursor: pointer; }
.act-filtro-fecha__rango input { width: auto; margin: 0; }
.act-filtro-fecha__inputs { display: flex; align-items: center; gap: var(--space-2); }
.act-filtro-fecha__inputs input[type=date] { flex: 1; min-width: 0; }
.act-filtro-fecha__sep { color: var(--ink-faint); }
.act-filtro-fecha__sep.is-hidden, .act-filtro-fecha__inputs input.is-hidden { display: none; }
.act-filtro-bloque { margin-bottom: var(--space-4); }
/* filtro de estado: un campo que se ve como un <select> pero es
   multi-seleccion - al abrirlo despliega la lista de checkboxes
   (reutiliza .act-filtro-checks/.act-filtro-check) y el propio campo
   va mostrando los estados marcados (los primeros 2 + "+N" si hay mas). */
.act-filtro-select { position: relative; margin-top: var(--space-2); }
.act-filtro-select__field {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
}
.act-filtro-select__field-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-faint); }
/* con estados marcados el campo deja de ser texto plano y muestra los
   mismos badges (forma/color) que la lista desplegable - mas fiel que
   repetir solo el nombre del estado en texto suelto. */
.act-filtro-select__field-texto.tiene-valor { display: flex; align-items: center; gap: 4px; overflow: hidden; color: var(--ink); }
.act-filtro-select__field-texto.tiene-valor .badge { flex-shrink: 0; }
.act-filtro-select__overflow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #141415;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.act-filtro-select__field svg { flex-shrink: 0; color: var(--ink-faint); transition: transform 0.12s; }
.act-filtro-select.is-open .act-filtro-select__field svg { transform: rotate(180deg); }
.act-filtro-select__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  z-index: 5;
  display: none;
  max-height: 170px;
  overflow-y: auto;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}
.act-filtro-select.is-open .act-filtro-select__panel { display: block; }
.act-filtro-select .act-filtro-checks { margin-top: 0; }
.act-filtro-checks { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.act-filtro-check { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.act-filtro-check input { width: auto; margin: 0; }
.act-filtros-panel__acciones { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* ---------- stat tiles ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.stat__value { font-family: var(--font-heading); font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat__label { font-size: 12.5px; color: var(--ink-soft); margin-top: var(--space-1); }
.stat--accent .stat__value { color: var(--link); }

/* ---------- home: today header ---------- */

.today-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.today-head__date { font-family: var(--font-heading); font-size: 30px; font-weight: 700; }
.today-head__sub { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }

/* ---------- selector de usuarios del kanban (admin/supervisor) ---------- */

.selector-usuarios { position: relative; display: inline-block; margin-bottom: var(--space-4); }
.selector-usuarios__trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}
.selector-usuarios__trigger svg { color: var(--ink-faint); flex-shrink: 0; }
.selector-usuarios__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2);
  z-index: 20;
  display: none;
}
.selector-usuarios__panel.is-open { display: block; }
.selector-usuarios__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13.5px;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.selector-usuarios__item:hover { background: var(--hover-bg); }
.selector-usuarios__item--todos { font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: var(--space-1); border-radius: 0; }
.selector-usuarios__item input[type=checkbox] { width: auto; margin: 0; }

/* ---------- activity list (home) ---------- */

.activity-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}
.activity-row:last-child { border-bottom: none; }
.activity-row__num {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-faint);
  width: 20px;
  flex-shrink: 0;
  padding-top: 2px;
}
.activity-row__main { flex: 1; min-width: 0; }
.activity-row__title { font-weight: 600; margin-bottom: 2px; }
.activity-row__desc { color: var(--ink-soft); font-size: 13.5px; }
.activity-row__meta { font-size: 12px; color: var(--ink-faint); margin-top: var(--space-1); }
.activity-row__status { flex-shrink: 0; }

.empty-note {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--ink-faint);
  font-size: 14px;
}

/* ---------- aviso de cierre de jornada pendiente (home) ---------- */

.aviso-cierre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.aviso-cierre__texto { color: var(--ink); font-size: 14px; }
.aviso-cierre__texto strong { font-weight: 600; }
.aviso-cierre--inline { max-width: 420px; padding: var(--space-3); }
.aviso-cierre.is-hidden { display: none; }

.kanban-board--bloqueado { position: relative; }
.kanban-board--bloqueado .kanban-card { cursor: default; }
.kanban-board--bloqueado .kanban-card:hover { border-color: var(--line); }

/* ---------- wizard de cierre de jornada ---------- */

.cierre-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.cierre-item__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.cierre-item__tarea { font-weight: 600; font-size: 14.5px; }
.cierre-item__desc { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.cierre-item__opciones { display: flex; gap: var(--space-4); margin-top: var(--space-3); flex-wrap: wrap; }
.cierre-radio { display: flex; align-items: center; gap: var(--space-2); font-size: 13.5px; cursor: pointer; }
.cierre-item__horas { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.cierre-item__horas.is-hidden { display: none; }
.field.is-hidden { display: none; }
.cierre-item__horas label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: var(--space-2); }
.cierre-item__horas--doble { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.cierre-section-title { font-weight: 600; font-size: 15px; margin: var(--space-5) 0 var(--space-2); }
.cierre-item--opcional { background: var(--paper); }
.cierre-check { display: flex; align-items: center; gap: var(--space-2); font-size: 13.5px; cursor: pointer; font-weight: 600; }
.cierre-item__detalle { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.cierre-item__detalle.is-hidden { display: none; }

/* ---------- login ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: center;
  background-blend-mode: overlay;
  background-color: #0e0e0f;
  padding: var(--space-4);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-6) var(--space-5);
  width: 100%;
  max-width: 380px;
}
.auth-card__brand { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: var(--link); margin-bottom: var(--space-1); }
.auth-card__title { font-size: 22px; margin-bottom: var(--space-1); }
.auth-card__sub { font-size: 13.5px; color: var(--ink-soft); margin-bottom: var(--space-5); }

/* ---------- avatar ---------- */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--link);
  font-family: var(--font-heading);
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.avatar--sm { width: 22px; height: 22px; font-size: 10px; }
.avatar--md { width: 32px; height: 32px; font-size: 13px; }
.avatar--lg { width: 56px; height: 56px; font-size: 20px; }

/* ---------- menu de cuenta (avatar arriba a la derecha) ---------- */

.account-menu { position: relative; }
.account-menu__trigger {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 50%;
}
.account-menu__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 190px;
  padding: var(--space-2);
  z-index: 20;
  display: none;
}
.account-menu__panel.is-open { display: block; }
.account-menu__who {
  padding: var(--space-2) var(--space-3);
  font-size: 12.5px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-1);
}
.account-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.account-menu__item:hover { background: var(--hover-bg); text-decoration: none; }
.account-menu__theme-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  color: var(--ink);
  font-size: 14px;
}
.theme-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-strong);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  transition: transform 0.15s ease;
}
:root[data-theme="dark"] .theme-toggle::before { transform: translateX(18px); }

/* ---------- utility ---------- */

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.text-soft { color: var(--ink-soft); }
.text-faint { color: var(--ink-faint); }
.text-sm { font-size: 13px; }

/* ---------- tablero kanban ---------- */

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  align-items: stretch; /* las 4 columnas comparten el alto de la mas alta */
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.kanban-col__head {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-col__count {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-faint);
  background: var(--paper);
  border-radius: 999px;
  padding: 1px 8px;
}
.kanban-col__body {
  padding: var(--space-3);
  min-height: 90px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.kanban-col__body.is-over { background: var(--paper); }

/* Columna a la que no se puede pasar desde el subestado que se esta
   arrastrando - grisada mientras dura el arrastre (dragover tampoco deja
   soltar ahi, esto es solo la señal visual). */
.kanban-col--no-permitida { opacity: 0.4; }
.kanban-col--no-permitida .kanban-col__body { pointer-events: none; }

.kanban-card {
  position: relative;
  display: block;
  min-width: 0; /* es flex item de .kanban-col__body - sin esto no se encoge
                   por debajo del ancho de su contenido (texto largo sin
                   espacios), asi que el overflow-wrap del titulo nunca
                   llega a aplicar y la tarjeta se sale de la columna. */
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.kanban-card:hover { border-color: var(--line-strong); }
.kanban-card.is-dragging { opacity: 0.4; }
/* cabeza de la tarjeta: id a la izquierda, abanico de responsables a la
   derecha (ya no van sueltos en una esquina absoluta - ahora comparten
   fila con el id). */
.kanban-card__cabeza { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.kanban-card__id { font-size: 11px; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
/* overflow-wrap para que un titulo sin espacios (una sola palabra muy
   larga) se parta y no reviente el ancho de la columna - |truncate(50) en
   el template corta por longitud de caracteres, pero Jinja NO corta en
   medio de una palabra sin espacios cercanos, asi que sin esto una
   cadena larga sin espacios se queda entera y desborda la tarjeta. */
.kanban-card__title { font-weight: 600; font-size: 13.5px; margin-bottom: var(--space-2); overflow-wrap: break-word; word-break: break-word; }
.kanban-card__meta { font-size: 11.5px; color: var(--ink-faint); }
/* icono + nombre de prioridad, mismo patron que .prioridad-boton--estatica
   del detalle pero a escala de tarjeta (icono mas chico, sin el svg de 14px). */
.kanban-card__prioridad { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
.kanban-card__prioridad .prioridad-icono { width: 18px; height: 18px; }

.kanban-card__avatar { display: flex; flex-shrink: 0; }

/* varios responsables en una tarjeta: fotos apiladas, la mas nueva encima */
.avatar-stack { display: flex; }
/* position:relative para que el z-index inline (ver _kanban_card.html,
   _lista.html, _dia.html) tenga efecto - el primero de izquierda a
   derecha queda ENCIMA del segundo, el segundo encima del tercero, etc,
   igual que el abanico de filtro de usuario de /actividades
   (act-avatar-toggle en actividades.js). */
.avatar-stack .avatar { margin-left: -5px; box-shadow: 0 0 0 2px var(--paper); position: relative; }
.avatar-stack .avatar:first-child { margin-left: 0; }
/* "+N" cuando hay mas de 3 responsables - mismo espiritu que el "+N" del
   abanico de filtro de Actividades (act-avatar-mas). */
.kanban-card__avatar-mas { display: flex; align-items: center; justify-content: center; background: var(--line); color: var(--ink-soft); font-size: 9.5px; font-weight: 700; }

.kanban-card--solo-lectura { cursor: default; }
.kanban-card--solo-lectura:hover { border-color: var(--line); }

/* tarjetas del kanban de dia (historial): no se editan, pero si se puede
   hacer clic para ver el detalle completo de la tarea */
.kanban-card--detalle { cursor: pointer; }

.kanban-board--5 { grid-template-columns: repeat(5, 1fr); }
.kanban-board--4 { grid-template-columns: repeat(4, 1fr); }

.kanban-empty {
  color: var(--ink-faint);
  font-size: 12.5px;
  text-align: center;
  padding: var(--space-3) 0;
}

/* ---------- creacion rapida inline (columna Pendiente del kanban) ---------- */

.kanban-quick-add { position: relative; }

.kanban-quick-add__trigger {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.kanban-quick-add__trigger:hover { border-color: var(--link); color: var(--link); }
.kanban-quick-add__trigger.is-hidden { display: none; }

.kanban-quick-add__aviso {
  font-size: 12px;
  color: var(--warn);
  margin-top: var(--space-2);
}
.kanban-quick-add__aviso.is-hidden { display: none; }

/* El form se despliega COMO POPOVER, mas ancho que la columna (2x) y
   centrado respecto a ella - para tener mas espacio visual para escribir
   el titulo sin que la columna en si cambie de tamano. */
.kanban-quick-add__form {
  position: absolute;
  top: 0;
  left: 50%;
  width: 200%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: var(--space-2);
}
.kanban-quick-add__form.is-hidden { display: none; }

/* check y cancelar viven DENTRO del mismo campo de texto, como iconos a
   la derecha - no son botones aparte al lado del input. */
.kanban-quick-add__field { position: relative; }
.kanban-quick-add__field input[type=text] {
  width: 100%;
  padding: 10px 70px 10px 12px;
  font-size: 14px;
  border: 1px solid var(--link);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
}
.kanban-quick-add__icons {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
}
.kanban-quick-add__ok,
.kanban-quick-add__cancel {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
/* Grisados por defecto - el check solo se "activa" (toma el color de
   accento) una vez que hay texto escrito; sin texto, no se puede crear
   nada, ni haciendo click ni con Enter (boton disabled de verdad). */
.kanban-quick-add__ok { background: var(--surface); color: var(--ink-faint); border: 1px solid var(--line-strong); cursor: not-allowed; }
.kanban-quick-add__ok:not(:disabled) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); cursor: pointer; }
.kanban-quick-add__ok:not(:disabled):hover { background: var(--accent-hover); }
.kanban-quick-add__cancel { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong); }
.kanban-quick-add__cancel:hover { border-color: var(--bad); color: var(--bad); }

/* ---------- dialogos (crear / detalle) ---------- */

dialog.kanban-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: var(--space-5);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}
dialog.kanban-dialog::backdrop { background: rgba(0,0,0,0.6); }
dialog.kanban-dialog h3 { margin-bottom: var(--space-4); }

dialog.kanban-dialog--ancho { max-width: 1040px; } /* mismo max-width que .page: el kanban del snapshot se ve del mismo ancho que el del home */

.kanban-dia__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.kanban-dia__fecha { font-family: var(--font-heading); font-size: 20px; font-weight: 600; }
.kanban-dia__sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

.detalle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.usuario-dialog__section {
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.usuario-dialog__section--last { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .today-head__date { font-size: 24px; }
  .topbar__inner { padding: var(--space-2) var(--space-4); }
  .page { padding: var(--space-4) var(--space-3) var(--space-6); }
}

@media (max-width: 900px) {
  .kanban-board {
    display: flex;
    overflow-x: auto;
    gap: var(--space-3);
    scroll-snap-type: x proximity;
    margin: 0 calc(var(--space-3) * -1);
    padding: 0 var(--space-3);
  }
  .kanban-col { min-width: 82vw; scroll-snap-align: start; }
}
