/* ============================================================================
   TABLERO DE TAREAS — sistema visual (identidad AltChat, sin marca visible)
   ----------------------------------------------------------------------------
   Fuente de verdad: C:\Desarrollo\Identidad Alt (02-paleta, 04-tipografia,
   05-sistema-visual). No se usa logo, isotipo ni la palabra de la marca: el
   producto se sigue llamando "Tablero de tareas".

   Idea: tablero de trabajo frío y preciso. Lienzo slate muy claro, columnas
   como cards (radio 18), tarjetas como insets blancos (radio 12), un solo
   acento celeste #00A8E8 SOLO para lo accionable (botón primario con texto
   oscuro, foco, links, drop). El tema claro es la "variante clara" de la
   guía (texto #0F172A, títulos en azul, acento #00A8E8, portada navy
   #0B1220: el login usa ese fondo navy con el glow radial de la marca).
   El oscuro (prefers-color-scheme) usa los tokens oficiales de la guía.

   Tipografía
     Familia única : Hanken Grotesk 400–800 (Google Fonts). No hay mono en el
                     sistema: ids, fechas y contadores van en Hanken con
                     figuras tabulares (.num / .mono = tnum).
     Gestos        : titulares 800 con tracking negativo; eyebrow 600 en
                     MAYÚSCULAS con tracking 0.14–0.16em (cabeceras de columna,
                     secciones del drawer, menú Descargar).
     Escala        : 11 · 12 · 13 · 14 (base) · 15 · 18 · 22 · 28   lh 1.5
   Espaciado      : 4 · 8 · 12 · 16 · 20 · 24 · 32
   Radios (guía)  : 10 botones/inputs · 11 icon-box · 12 tarjetas/insets ·
                    18 columnas, drawer, login · 999 chips/píldoras
   Sombras        : s1 reposo, s2 hover/popovers, s3 drawer/login;
                    hover del primario 0 10px 30px rgba(0,168,232,.28)
   Movimiento     : cubic-bezier(.2,.7,.2,1), hovers 0.2s, nada rebota.

   Semántica (adaptada para convivir con la paleta y pasar AA)
     Error/vencida : #E5484D de la guía para puntos/bordes; chip vencida
                     sólido #C9282D con texto blanco (5.5:1).
     Atención/≤2d  : #E9B949 de la guía para puntos; texto #8A5A00 sobre
                     #FDF3D6 (5.4:1).
     OK/hecho      : #2FBF71 puntos; texto #13794A sobre #E3F6EC.
     Asistente     : violeta propio #6D4FE0 (distinto del azul de marca).
     Columnas      : Backlog slate · Hacer azul Alt #158FCF · En curso ámbar ·
                     Hecho verde. Tarjetas hechas atenuadas y tachadas.
     Prioridad     : alta = franja roja a la izquierda + chip rojo suave;
                     media = punto ámbar; baja = contorno neutro.
   Layout         : header sticky (marca · espacios · acciones / stats ·
                    filtros) → board con scroll horizontal (4 columnas,
                    82vw con snap en móvil) → leyenda. Drawer 620px a la
                    derecha, pantalla completa en móvil.
   ========================================================================== */
:root {
  color-scheme: light;

  /* Neutros slate (variante clara) */
  --bg: #f3f6fa;
  --bg-col: #e9eef5;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #5b6b82;   /* AA sobre blanco y sobre la columna */
  --ink-4: #94a3b8;   /* solo decorativo */
  --navy: #0b1220;

  /* Marca */
  --brand: #158fcf;          /* Azul Alt: estructura */
  --accent: #00a8e8;         /* acción */
  --accent-hover: #19b4ef;
  --accent-strong: #0086ba;
  --accent-soft: #e2f4fc;
  --accent-ink: #006e9c;     /* acento como texto sobre claro (5.4:1) */
  --on-accent: #0a0f1a;      /* texto del botón primario: oscuro, no blanco */
  --ring: #00a8e8;

  /* Semántica */
  --red: #e5484d;      --red-solid: #c9282d; --red-soft: #fdecec;   --red-ink: #b42318;
  --amber: #e9b949;    --amber-soft: #fdf3d6; --amber-ink: #8a5a00;
  --green: #2fbf71;    --green-soft: #e3f6ec; --green-ink: #13794a;
  --blue: #158fcf;     --blue-soft: #e4f2fb;  --blue-ink: #0b5e8e;
  --violet: #6d4fe0;   --violet-soft: #efebfe; --violet-ink: #5b3fd1;

  /* Columnas */
  --c-backlog: #94a3b8;
  --c-todo: var(--blue);
  --c-doing: var(--amber);
  --c-done: var(--green);

  /* WhatsApp (cita del mensaje original) */
  --wa-bubble: #e7f6e9;
  --wa-ink: #173a24;

  --r-1: 6px; --r-2: 10px; --r-icon: 11px; --r-3: 12px; --r-4: 18px; --r-pill: 999px;
  --s1: 0 1px 2px rgba(15, 23, 42, 0.05), 0 0 0 1px rgba(15, 23, 42, 0.02);
  --s2: 0 10px 28px -10px rgba(15, 23, 42, 0.22), 0 2px 4px rgba(15, 23, 42, 0.05);
  --s3: 0 30px 70px -20px rgba(11, 18, 32, 0.38), 0 2px 6px rgba(15, 23, 42, 0.08);
  --s-accent: 0 10px 30px rgba(0, 168, 232, 0.28);

  --font: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --grad: linear-gradient(110deg, #6bc7e6, #158fcf 55%, #235da9);

  --header-h: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 160ms;
  --t-med: 240ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* Tokens oficiales (sistema oscuro de la guía) */
    --bg: #0a0f1a;
    --bg-col: #0c1420;
    --surface: #0e1725;
    --surface-2: #111e30;
    --surface-3: #15243a;
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.14);
    --ink: #eaeef4;
    --ink-2: #b4becd;
    --ink-3: #97a3b6;
    --ink-4: #5e6b80;
    --navy: #0b1220;
    --accent-hover: #33baf0;
    --accent-strong: #62c5e2;
    --accent-soft: rgba(0, 168, 232, 0.14);
    --accent-ink: #62c5e2;
    --red-solid: #c9282d; --red-soft: rgba(229, 72, 77, 0.16);  --red-ink: #ff9a9d;
    --amber-soft: rgba(233, 185, 73, 0.15); --amber-ink: #f1cf7e;
    --green-soft: rgba(47, 191, 113, 0.15); --green-ink: #7ddca6;
    --blue: #62c5e2; --blue-soft: rgba(21, 143, 207, 0.18); --blue-ink: #9ad8ee;
    --violet: #a993ff; --violet-soft: rgba(124, 92, 250, 0.2); --violet-ink: #c9bcff;
    --c-backlog: #5e6b80;
    --wa-bubble: #13281c;
    --wa-ink: #cfe9d6;
    --s1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --s2: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
    --s3: 0 30px 70px rgba(0, 0, 0, 0.5);
  }
}

/* ------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; height: 100%; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  display: flex; flex-direction: column; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
/* Campos de texto: el estilo "de input" va SOLO a campos de texto, no a
   checkboxes/radios (antes heredaban width 100% y padding y se veían gigantes). */
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-2);
  padding: 9px 12px; min-height: 40px; width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:not([type="checkbox"]):not([type="radio"]):hover, textarea:hover, select:hover { border-color: var(--ink-4); }
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent); }
button:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.mono, .num { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
svg.i { width: 1em; height: 1em; flex: none; vertical-align: -0.12em; }
.eyebrow-txt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }

/* ------------------------------------------------------------ botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  border-radius: var(--r-2); padding: 0 14px; min-height: 40px; font-weight: 600; font-size: 13.5px;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast) var(--ease), color var(--t-fast);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); transform: translateY(-2px); box-shadow: var(--s-accent); }
.btn.primary:active { transform: none; box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { color: var(--red-ink); background: transparent; border-color: transparent; }
.btn.danger:hover { background: var(--red-soft); color: var(--red-ink); }
.btn.success { background: var(--green-soft); border-color: transparent; color: var(--green-ink); }
.btn.success:hover { background: color-mix(in srgb, var(--green) 22%, var(--green-soft)); color: var(--green-ink); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
.link { background: none; border: 0; color: var(--accent-ink); padding: 4px 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.link:hover { text-decoration-color: var(--accent); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-icon); flex: none;
  border: 0; background: transparent; color: var(--ink-3);
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------ header */
header.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-block: 10px 10px;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: grid; align-items: center; gap: 10px 20px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "brand  spaces  actions"
    "stats  stats   toolbar";
}
header.top > .brand { grid-area: brand; min-height: 40px; }
header.top > .spaces { grid-area: spaces; justify-self: start; }
header.top > .top-actions { grid-area: actions; }
header.top > .stats { grid-area: stats; }
header.top > .toolbar { grid-area: toolbar; }

/* marca tipográfica: icon-box navy con la T en 800 + subrayado de acento */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  position: relative; width: 36px; height: 36px; border-radius: var(--r-icon); flex: none;
  background: var(--navy); color: #eaeef4;
  display: grid; place-items: center; font-family: var(--font); font-weight: 800; font-size: 19px; line-height: 1; letter-spacing: -0.02em; padding-bottom: 5px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.mark::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 12px; height: 2px; margin-left: -6px; border-radius: 2px; background: var(--accent); }
.brand .t { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand .title { font-size: 17px; font-weight: 800; letter-spacing: -0.025em; color: var(--ink); white-space: nowrap; }
.brand .title em { font-style: normal; color: var(--ink-3); font-weight: 700; }
.brand .sub { font-size: 12px; font-weight: 500; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* selector de espacio: control segmentado */
.spaces {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px; max-width: 100%;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-pill);
  overflow-x: auto; scrollbar-width: none;
}
.spaces::-webkit-scrollbar { display: none; }
.space {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 32px; padding: 0 8px 0 14px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.space:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.space .n {
  font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; font-size: 11.5px; font-weight: 700;
  min-width: 22px; padding: 1px 6px; border-radius: var(--r-pill); text-align: center;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-3);
}
.space.on { background: var(--surface); color: var(--ink); box-shadow: var(--s1), 0 0 0 1px var(--line); }
.space.on .n { background: var(--accent-soft); color: var(--accent-ink); }

.top-actions { display: flex; align-items: center; gap: 8px; justify-self: end; min-width: 0; }

.stats { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.stat {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line);
  font-weight: 500; white-space: nowrap; flex: none;
}
.stat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); }
.stat b { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink); }
.stat.open::before { background: var(--c-todo); }
.stat.done::before { background: var(--green); }
.stat.warn { background: var(--amber-soft); color: var(--amber-ink); border-color: transparent; }
.stat.warn::before { background: var(--amber); }
.stat.warn b { color: var(--amber-ink); }
.stat.bad { background: var(--red-soft); color: var(--red-ink); border-color: transparent; }
.stat.bad::before { background: var(--red); }
.stat.bad b { color: var(--red-ink); }

.toolbar { display: flex; gap: 6px; align-items: center; justify-self: end; min-width: 0; }
.toolbar select { width: auto; min-width: 200px; max-width: 260px; min-height: 36px; padding-block: 6px; font-size: 13px; font-weight: 500; }
/* switch chico con label (Ocultar hechas viejas) */
.toggle {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2);
  padding: 0 10px; min-height: 36px; border-radius: var(--r-2); cursor: pointer; user-select: none; white-space: nowrap;
}
.toggle:hover { background: var(--surface-3); }
.toggle .lbl-short { display: none; }
.switch, .toggle input {
  appearance: none; -webkit-appearance: none; width: 30px; height: 18px; min-height: 0; margin: 0; padding: 0;
  border-radius: 999px; background: var(--line-2); border: 0; position: relative; flex: none; cursor: pointer;
  transition: background var(--t-fast);
}
.switch::after, .toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--t-fast) var(--ease); }
.switch:checked, .toggle input:checked { background: var(--accent); }
.switch:checked::after, .toggle input:checked::after { transform: translateX(12px); }
.switch:focus-visible, .toggle input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* usuario: avatar + nombre es un botón que abre "Mi perfil" */
.user { display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--ink-2); padding-left: 10px; border-left: 1px solid var(--line); min-width: 0; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px 0 4px;
  border: 1px solid transparent; border-radius: var(--r-pill); background: transparent; color: var(--ink);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.user-btn:hover { background: var(--surface-3); }
.user-btn[aria-expanded="true"] { background: var(--surface-3); border-color: var(--line); }
.user-btn .name { font-weight: 600; white-space: nowrap; }
.user-btn .chev { width: 14px; height: 14px; color: var(--ink-3); }

/* avatares con color estable por persona */
.av {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
  background: var(--surface-3); color: var(--ink-2); text-transform: uppercase;
}
.av.lg { width: 32px; height: 32px; font-size: 12px; }
.av.xl { width: 52px; height: 52px; font-size: 18px; font-weight: 800; }
.av.h0 { background: #dcecf9; color: #0b5e8e; }
.av.h1 { background: #dbf1f4; color: #0d5c66; }
.av.h2 { background: #fcefd9; color: #7d4f00; }
.av.h3 { background: #f7e1e8; color: #8d2d4e; }
.av.h4 { background: #e6e9fb; color: #303f9c; }
.av.h5 { background: #e2f3df; color: #2f6418; }
.av.h6 { background: #f9e5da; color: #8f3b16; }
.av.h7 { background: #e3e9f1; color: #334155; }
.av.bot { background: var(--violet-soft); color: var(--violet-ink); }
.av.bot svg { width: 14px; height: 14px; }
.av.none { background: transparent; border: 1.5px dashed var(--line-2); color: var(--ink-3); }
@media (prefers-color-scheme: dark) {
  .av.h0 { background: #12314a; color: #9ad8ee; } .av.h1 { background: #10343a; color: #8fdde6; }
  .av.h2 { background: #3a2c12; color: #f1cf7e; } .av.h3 { background: #3c1d2a; color: #f0a9c2; }
  .av.h4 { background: #1f2550; color: #b9c3ff; } .av.h5 { background: #1c3418; color: #b2e09a; }
  .av.h6 { background: #3d2217; color: #f2b59b; } .av.h7 { background: #1c2738; color: #c6ceda; }
}

/* ------------------------------------------------------------ board */
main.board-wrap {
  flex: 1; min-height: 0; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  padding-block: 16px 12px;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.board { display: grid; grid-template-columns: repeat(4, minmax(264px, 1fr)); gap: 14px; height: 100%; min-width: 1096px; }
.col {
  background: var(--bg-col); border-radius: var(--r-4);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border: 1.5px solid transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.col.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-col)); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px 16px; min-height: 50px; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-backlog); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-backlog) 22%, transparent); }
.col[data-state="todo"] .col-head .dot { background: var(--c-todo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-todo) 20%, transparent); }
.col[data-state="doing"] .col-head .dot { background: var(--c-doing); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-doing) 24%, transparent); }
.col[data-state="done"] .col-head .dot { background: var(--c-done); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-done) 20%, transparent); }
/* cabecera de columna = eyebrow de la marca */
.col-head h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.col-head .n { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 8px; line-height: 1.6; }
.col-head .hint { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards { flex: 0 1 auto; overflow-y: auto; padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.cards:empty { margin: 2px 8px 8px; border: 1.5px dashed var(--line-2); border-radius: var(--r-3); display: grid; place-items: center; color: var(--ink-3); font-size: 12.5px; padding: 0; flex: 0 0 auto; min-height: 96px; }
.cards:empty::after { content: "Nada por acá todavía"; }
.col.over .cards:empty { border-color: var(--accent); color: var(--accent-ink); }
.col.over .cards:empty::after { content: "Soltá la tarjeta acá"; }
/* "+ Agregar tarjeta" justo debajo de la última tarjeta: con muchas, las
   tarjetas scrollean y el botón queda siempre visible al pie de la lista */
.add-card {
  display: flex; align-items: center; gap: 8px; flex: none;
  margin: 0 8px 10px; min-height: 38px; padding: 0 10px; border: 0; border-radius: var(--r-2);
  background: transparent; color: var(--ink-3); font-size: 13px; font-weight: 600; text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.add-card svg { width: 16px; height: 16px; }
.add-card:hover { background: color-mix(in srgb, var(--surface) 75%, transparent); color: var(--accent-ink); }
.add-card:focus-visible { outline-offset: -2px; }

/* ------------------------------------------------------------ tarjeta */
.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3);
  padding: 12px 14px 12px 15px; cursor: grab; box-shadow: var(--s1);
  flex-shrink: 0; /* con muchas tarjetas la columna scrollea: nunca se aplastan */
  transition: box-shadow var(--t-fast), transform var(--t-fast) var(--ease), border-color var(--t-fast), opacity var(--t-fast);
  overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.card:hover { box-shadow: var(--s2); transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.4; transform: rotate(1.5deg) scale(0.98); }
.card.prio-alta::before { background: var(--red); }
.card .top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); min-width: 0; }
.card .top .kind { display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card .top .kind::first-letter, .panel-head .eyebrow .kind::first-letter { text-transform: uppercase; }
.card .top .sep { color: var(--ink-4); }
.card .top .spark { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--violet); font-size: 11.5px; font-weight: 700; }
.card .top .spark svg { width: 13px; height: 13px; }
.card .title { font-size: 14.5px; font-weight: 700; line-height: 1.36; letter-spacing: -0.01em; margin: 4px 0 10px; color: var(--ink); text-wrap: pretty; overflow-wrap: anywhere; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.card .who { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-right: 2px; max-width: 100%; }
.card .who .av { width: 22px; height: 22px; font-size: 9.5px; }
.card .who.none { color: var(--amber-ink); }
.card .foot { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-3); }
.card .foot span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.card .foot svg { width: 13px; height: 13px; color: var(--ink-4); }
.card .foot .req { color: var(--ink-2); }
.card .foot .req b { font-weight: 600; color: var(--ink); }
.card .foot .cm { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; font-weight: 600; }

/* hechas: atenuadas */
.card.done { background: color-mix(in srgb, var(--surface) 62%, var(--bg-col)); border-color: transparent; box-shadow: none; }
.card.done:hover { box-shadow: var(--s1); border-color: var(--line); transform: none; }
.card.done .title { color: var(--ink-3); font-weight: 500; text-decoration: line-through; text-decoration-color: var(--ink-4); text-decoration-thickness: 1px; }
.card.done .top, .card.done .foot, .card.done .who, .card.done .top .num { color: var(--ink-3); }
.card.done .top .spark { color: var(--ink-3); }
.card.done .av { filter: saturate(0.25); opacity: 0.8; }
.card.done .foot { border-top-color: transparent; padding-top: 0; margin-top: 6px; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-pill);
  padding: 2px 9px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.chip svg { width: 12px; height: 12px; }
.chip.due { font-weight: 500; color: var(--ink-2); background: transparent; border: 1px solid var(--line-2); padding-block: 1px; }
.chip.due .num { font-weight: 700; }
.chip.due.soon { background: var(--amber-soft); color: var(--amber-ink); border-color: transparent; font-weight: 600; }
.chip.due.late { background: var(--red-solid); color: #fff; border-color: transparent; font-weight: 700; box-shadow: 0 2px 6px color-mix(in srgb, var(--red) 35%, transparent); }
.chip.due.closed { color: var(--ink-3); border-style: dashed; }
.chip.bot { background: var(--violet-soft); color: var(--violet-ink); }
.chip.nc { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-3); font-weight: 500; }
.chip.prio { text-transform: none; gap: 5px; }
.chip.prio::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.prio.alta { background: var(--red-soft); color: var(--red-ink); }
.chip.prio.alta::before { background: var(--red); }
.chip.prio.media { background: var(--surface-3); color: var(--ink-2); }
.chip.prio.media::before { background: var(--amber); }
.chip.prio.baja { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.chip.prio.baja::before { background: var(--ink-4); }
.state-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.state-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-backlog); }
.state-badge.s-todo { background: var(--blue-soft); color: var(--blue-ink); } .state-badge.s-todo::before { background: var(--c-todo); }
.state-badge.s-doing { background: var(--amber-soft); color: var(--amber-ink); } .state-badge.s-doing::before { background: var(--c-doing); }
.state-badge.s-done { background: var(--green-soft); color: var(--green-ink); } .state-badge.s-done::before { background: var(--c-done); }

/* ------------------------------------------------------------ leyenda */
.legend {
  padding-block: 2px 12px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  font-size: 12px; color: var(--ink-3); display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center;
}
.legend .chip { font-size: 11.5px; padding-block: 1px; }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend .tip { color: var(--ink-3); }

/* ------------------------------------------------------------ drawer */
.backdrop {
  position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end;
  background: rgba(11, 18, 32, 0.45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: fade var(--t-med) var(--ease);
}
.panel {
  width: min(620px, 100%); height: 100%; background: var(--surface); box-shadow: var(--s3);
  display: flex; flex-direction: column; min-height: 0;
  animation: slide var(--t-med) var(--ease);
}
.panel.narrow { width: min(460px, 100%); }
.panel-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px 24px;
  border-bottom: 1px solid var(--line); flex: none; background: var(--surface);
}
.panel-head .eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; font-size: 12.5px; color: var(--ink-3); }
.panel-head .eyebrow .num { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.panel-head .eyebrow .kind { display: inline-block; }
.panel-head .eyebrow .sep { color: var(--ink-4); }
.panel-head .eyebrow .ttl { font-weight: 800; letter-spacing: -0.02em; color: var(--ink); font-size: 16px; }
.panel-head .close { margin-left: auto; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px 24px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.panel-body textarea.title {
  display: block; font-size: 22px; font-weight: 800; line-height: 1.25; letter-spacing: -0.025em; text-wrap: pretty;
  padding: 6px 10px; margin: 0 -10px; width: calc(100% + 20px); border-color: transparent; background: transparent;
  min-height: 0; resize: none; overflow: hidden; color: var(--ink);
}
.panel-body textarea.title:hover { background: var(--surface-2); }
.panel-body textarea.title:focus { background: var(--surface); border-color: var(--ring); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 6px; }
.field.full { grid-column: 1 / -1; }
.field select, .field input, .field textarea { background-color: var(--surface-2); }
.field select:focus, .field input:focus, .field textarea:focus { background-color: var(--surface); }

.origin { margin-top: 20px; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; }
.origin .wa {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green-soft); color: var(--green-ink);
}
.origin .wa svg { width: 18px; height: 18px; }
.origin .who { font-size: 12px; color: var(--ink-3); margin: 0 0 4px 2px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.origin .who b { font-weight: 700; color: var(--ink-2); }
.origin .who .ts { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; font-size: 12px; }
.origin .bubble {
  position: relative; background: var(--wa-bubble); color: var(--wa-ink);
  border-radius: 2px 12px 12px 12px; padding: 9px 12px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.origin .bubble::before { content: ""; position: absolute; left: -7px; top: 0; border: 7px solid transparent; border-top-color: var(--wa-bubble); border-right-color: var(--wa-bubble); border-left: 0; }

/* título de sección = eyebrow de la marca */
.section-title { display: flex; align-items: center; gap: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); margin: 28px 0 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comments:empty::after { content: "Todavía no hay comentarios."; color: var(--ink-3); font-size: 12.5px; }
.comment { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.comment .av { width: 28px; height: 28px; font-size: 11px; }
.comment .bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 2px 12px 12px 12px; padding: 8px 12px 9px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.55; }
.comment.bot .bubble { background: color-mix(in srgb, var(--violet-soft) 60%, var(--surface)); border-color: color-mix(in srgb, var(--violet) 22%, transparent); }
.comment .by { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.comment .by b { color: var(--ink); font-weight: 700; }
.comment.bot .by b { color: var(--violet-ink); }
.comment .by .ts { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.comment.sys { align-items: center; }
.comment.sys .tick { justify-self: center; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.comment.sys .bubble { background: transparent; border: 0; padding: 2px 0; color: var(--ink-3); font-size: 12.5px; }
.comment.sys .bubble .ts { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 600; margin-right: 6px; }
.add-comment { display: grid; grid-template-columns: 28px 1fr; gap: 10px; margin-top: 14px; align-items: start; }
.add-comment .av { width: 28px; height: 28px; font-size: 11px; margin-top: 6px; }
.add-comment .box { display: flex; flex-direction: column; gap: 8px; }
.add-comment textarea { min-height: 64px; background: var(--surface-2); }
.add-comment textarea:focus { background: var(--surface); }
.add-comment .row { display: flex; justify-content: flex-end; }

.actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: none;
  padding: 12px 24px; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: var(--surface);
}
.actions .spacer { flex: 1; }

/* ------------------------------------------------------------ mi perfil */
.profile-id { display: flex; align-items: center; gap: 14px; padding: 4px 0 4px; }
.profile-id .nm { font-size: 20px; font-weight: 800; letter-spacing: -0.025em; color: var(--ink); line-height: 1.2; }
.profile-id .em { font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.profile-id .rol { display: inline-block; margin-top: 4px; }
.ro-list { margin: 18px 0 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.ro { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 11px 14px; font-size: 13.5px; background: var(--surface-2); }
.ro + .ro { border-top: 1px solid var(--line); }
.ro dt { color: var(--ink-3); font-weight: 600; font-size: 12.5px; }
.ro dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.inline-save { display: flex; gap: 8px; align-items: stretch; }
.inline-save input { flex: 1; min-width: 0; }
.inline-save .btn { flex: none; }
.pass-row { display: flex; justify-content: flex-end; margin-top: 12px; }
.help { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.help.err { color: var(--red-ink); }
.help.ok { color: var(--green-ink); }
.profile-out { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); }

/* ------------------------------------------------------------ toast */
#toastHost { position: fixed; left: 0; right: 0; bottom: max(18px, env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; pointer-events: none; z-index: 30; }
.toast {
  background: var(--navy); color: #eaeef4; padding: 10px 16px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  box-shadow: var(--s2); display: inline-flex; align-items: center; gap: 8px; max-width: min(92vw, 520px);
  animation: toastin var(--t-med) var(--ease);
}
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.2); flex: none; }
.toast.err { background: var(--red-solid); color: #fff; }
.toast.err::before { background: #fff; box-shadow: none; }

/* ------------------------------------------------------------ login */
/* Portada navy con el glow radial de la marca (uno solo). */
.login-wrap {
  flex: 1; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(760px 480px at 50% 0%, rgba(21, 143, 207, 0.22), transparent 62%),
    #0a0f1a;
}
.login { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-4); box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4); padding: 32px 32px 28px; }
.login .head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.login .head .mark { width: 44px; height: 44px; font-size: 23px; padding-bottom: 6px; }
.login .head .mark::after { bottom: 8px; width: 14px; margin-left: -7px; }
.login .head .title { font-size: 30px; font-weight: 800; line-height: 1.06; letter-spacing: -0.035em; color: var(--ink); }
.login .head .title em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login .head .sub { font-size: 14px; color: var(--ink-3); margin-top: -4px; line-height: 1.55; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login .field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.login .btn.primary { min-height: 44px; font-size: 14px; margin-top: 4px; }
.login .err, .login .ok { border-radius: var(--r-2); padding: 9px 12px; font-size: 13px; line-height: 1.45; display: flex; gap: 8px; align-items: flex-start; }
.login .err { background: var(--red-soft); color: var(--red-ink); }
.login .ok { background: var(--green-soft); color: var(--green-ink); }
.login #msg:empty { display: none; }
.login .foot { font-size: 13px; color: var(--ink-3); text-align: center; margin-top: 6px; }

/* ------------------------------------------------------------ complementos */
.card .top .num { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.card.late:not(.done) { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.card:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.col[data-state="backlog"] .cards:empty::after { content: "Sin pendientes nuevos. Lo que llegue del grupo cae acá."; }
.col[data-state="todo"] .cards:empty::after { content: "Nada asignado por hacer."; }
.col[data-state="doing"] .cards:empty::after { content: "Nadie está con algo en curso."; }
.col[data-state="done"] .cards:empty::after { content: "Todavía no se cerró nada."; }
.col.over .cards:empty::after { content: "Soltá la tarjeta acá"; }
.cards:empty { padding: 16px 20px; text-align: center; line-height: 1.45; }
.col.over .col-head h2 { color: var(--accent-ink); }

.space-tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 2px 9px; border-radius: var(--r-pill); border: 1px solid var(--line-2); white-space: nowrap; }
.legend-prio { width: 4px; height: 16px; border-radius: 2px; background: var(--red); }

.backdrop.closing { animation: fadeout 170ms var(--ease) forwards; }
.backdrop.closing .panel { animation: slideout 170ms var(--ease) forwards; }

@media (prefers-color-scheme: dark) {
  .backdrop { background: rgba(0, 0, 0, 0.6); }
  .toast { background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-2); }
  .mark { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); }
  .card.done { background: color-mix(in srgb, var(--surface) 50%, var(--bg-col)); }
  .login-wrap { background: radial-gradient(760px 480px at 50% 0%, rgba(21, 143, 207, 0.16), transparent 62%), var(--bg); }
  .login { border-color: var(--line-2); }
  select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2397a3b6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
}

/* ------------------------------------------------------------ menú Descargar */
.dl { position: relative; }
#btnDl .chev { width: 13px; height: 13px; color: var(--ink-3); margin-left: -2px; transition: transform var(--t-fast) var(--ease); }
#btnDl[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }
#btnDl[aria-expanded="true"] .chev { transform: rotate(180deg); }
.dl-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 300px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3);
  box-shadow: var(--s2); padding: 6px;
  animation: pop var(--t-fast) var(--ease); transform-origin: top right;
}
.dl-head { padding: 8px 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.dl-head .eyebrow-txt { font-size: 11px; }
/* alcance: segmentado "Este espacio / Todos" (dos radios; #dlTodos es el segundo) */
.dl-scope { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-2); }
.dl-scope input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.dl-scope label {
  display: flex; align-items: center; justify-content: center; min-height: 30px; padding: 0 8px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.dl-scope label:hover { color: var(--ink); }
.dl-scope input:checked + label { background: var(--surface); color: var(--ink); box-shadow: var(--s1), 0 0 0 1px var(--line); }
.dl-scope input:focus-visible + label { outline: 2px solid var(--ring); outline-offset: 1px; }
.dl-sep { height: 1px; background: var(--line); margin: 2px 4px 4px; }
.dl-menu a {
  display: grid; grid-template-columns: 34px 1fr; gap: 2px 12px; align-items: center;
  padding: 9px 10px; border-radius: var(--r-2); color: var(--ink); text-decoration: none;
  transition: background var(--t-fast);
}
.dl-menu a:hover, .dl-menu a:focus-visible { background: var(--surface-3); outline: none; }
.dl-menu a:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }
.dl-ic { grid-row: span 2; width: 34px; height: 34px; border-radius: var(--r-icon); display: grid; place-items: center; }
.dl-ic svg { width: 17px; height: 17px; }
.dl-ic.xlsx { background: var(--green-soft); color: var(--green-ink); }
.dl-ic.csv { background: var(--accent-soft); color: var(--accent-ink); }
.dl-t { font-size: 13.5px; font-weight: 700; line-height: 1.25; display: flex; align-items: center; gap: 6px; }
.dl-t .ext { font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 0 6px; border: 1px solid var(--line-2); border-radius: var(--r-pill); line-height: 1.5; }
.dl-d { font-size: 12px; color: var(--ink-3); line-height: 1.35; }

/* ------------------------------------------------------------ animaciones */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideup { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes slideout { to { transform: translateX(32px); opacity: 0; } }
@keyframes slidedown { to { transform: translateY(24px); opacity: 0; } }
@keyframes toastin { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(4, 300px); min-width: 0; width: max-content; }
  main.board-wrap { scroll-snap-type: x proximity; scroll-padding-inline: 20px; }
  .col { scroll-snap-align: start; }
  .col-head .hint { display: none; }
  .user-btn .name { display: none; }
  main.board-wrap.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
  main.board-wrap.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 40px), transparent); }
  main.board-wrap.more-l:not(.more-r) { -webkit-mask-image: linear-gradient(to right, transparent, #000 24px); mask-image: linear-gradient(to right, transparent, #000 24px); }
}
@media (max-width: 960px) {
  .user .lbl { display: none; }
  .user .btn.sm { width: 40px; min-height: 40px; padding: 0; }
  .toolbar select { min-width: 170px; }
}
@media (max-width: 720px) {
  header.top {
    padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
    padding-block: 8px 10px; gap: 8px 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand   actions"
      "spaces  spaces"
      "toolbar toolbar"
      "stats   stats";
  }
  header.top:has(> .spaces[hidden]) {
    grid-template-areas:
      "brand   actions"
      "toolbar toolbar"
      "stats   stats";
  }
  .brand { gap: 10px; }
  .mark { width: 34px; height: 34px; font-size: 18px; }
  .brand .title { font-size: 16px; }
  .top-actions { gap: 4px; }
  #btnDl .lbl, #btnDl .chev { display: none; }
  #btnDl { width: 40px; min-height: 40px; padding: 0; }
  #btnDl svg { width: 18px; height: 18px; }
  /* en móvil "Salir" vive dentro de Mi perfil */
  .user { border-left: 0; padding-left: 0; gap: 0; }
  .user #btnOut { display: none; }
  .user-btn { padding: 0 2px; }
  .user-btn .chev { display: none; }
  .user-btn .av { width: 32px; height: 32px; font-size: 12px; }
  /* el menú se ancla al header (sticky) y ocupa el ancho útil */
  .dl { position: static; }
  .dl-menu { left: 16px; right: 16px; width: auto; top: 54px; transform-origin: top center; }
  .dl-menu a { min-height: 56px; }
  .dl-scope label { min-height: 36px; }
  header.top > .spaces { justify-self: stretch; display: flex; padding: 0; gap: 6px; background: transparent; border: 0; border-radius: 0; }
  .space { min-height: 40px; padding: 0 10px 0 14px; flex: 1 0 auto; justify-content: space-between; background: var(--surface-3); border: 1px solid var(--line); }
  .space.on { background: var(--surface); border-color: var(--accent); box-shadow: var(--s1); }
  .toolbar { justify-self: stretch; gap: 8px; }
  .toolbar select { flex: 1; min-width: 0; max-width: none; min-height: 40px; }
  .toggle { min-height: 40px; padding-inline: 10px; background: var(--surface-3); flex: none; }
  .toggle .lbl { display: none; }
  .toggle .lbl-short { display: inline; }
  .stats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; font-size: 12px; }
  .stats::-webkit-scrollbar { display: none; }
  .stat { padding: 3px 9px 3px 8px; }

  main.board-wrap { padding-inline: 16px; padding-block: 12px 14px; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; }
  main.board-wrap.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  main.board-wrap.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 28px), transparent); }
  .board { grid-template-columns: repeat(4, min(82vw, 340px)); gap: 10px; width: max-content; }
  .col { scroll-snap-align: start; }
  .cards { padding-inline: 6px; }
  .add-card { margin-inline: 6px; min-height: 44px; }
  .legend { display: none; }

  .backdrop { justify-content: stretch; }
  .panel, .panel.narrow { width: 100%; animation-name: slideup; }
  .backdrop.closing .panel { animation-name: slidedown; }
  .panel-head { padding: 10px 8px 10px 16px; padding-top: max(10px, env(safe-area-inset-top, 0px)); position: sticky; top: 0; }
  .panel-head .close { width: 44px; height: 44px; background: var(--surface-3); color: var(--ink); border-radius: var(--r-pill); }
  .panel-body { padding: 16px 16px 24px; }
  .panel-body textarea.title { font-size: 20px; }
  .fields { grid-template-columns: 1fr; gap: 12px; }
  .field input, .field select { min-height: 44px; }
  .inline-save .btn { min-height: 44px; }
  .ro { grid-template-columns: 1fr; gap: 2px; }
  .origin { grid-template-columns: 28px 1fr; }
  .origin .wa { width: 28px; height: 28px; }
  .actions { padding-inline: 16px; gap: 8px; }
  .actions .btn { min-height: 44px; }
  .actions #btnDone, .actions #btnReopen { flex: 1 1 100%; order: -2; }
  .actions #btnNoCorr { order: -1; }
  .actions #btnSave { flex: 1 1 auto; }
  .actions .spacer { display: none; }
  .add-comment .btn.sm { min-height: 40px; }
  .profile-out .btn { min-height: 44px; }
  .login { padding: 28px 22px 24px; }
  .login .head .title { font-size: 28px; }
  .login input { min-height: 46px; font-size: 16px; }
  .login .btn.primary { min-height: 48px; }
  .login .link { min-height: 40px; }
}
@media (max-width: 380px) {
  .brand .mark { display: none; }
}
