/* NexusTasks v3 — mesa de corte de película.
   Un solo naranja grano sobre tinta; el texto que importa va en ventanas blancas;
   el estado es una marca (cruz, bandera, pin), nunca solo un color. */
@font-face {
  font-family: "League Gothic";
  src: url("/v3/fonts/league-gothic-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("/v3/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --ink: #0a0a0a;
  --charred: #141414;
  --spool: #1f1f1f;
  --spool-hi: #2a2a2a;
  --rule: #333333;          /* filete decorativo */
  --edge-line: #707070;     /* borde de control: 3,6:1 sobre --charred */

  --text: #f2f2f2;
  --text-2: #bdbdbd;
  --text-3: #9c9c9c;        /* 6,2:1 sobre --spool */

  --orange: #ff5a1f;        /* 6,3:1 contra tinta, en ambos sentidos */
  --orange-hi: #ff7644;
  --orange-ink: #b83a0b;    /* naranja legible sobre blanco: 5,4:1 */

  --punched: #ffffff;
  --paper-ink: #0a0a0a;
  --paper-2: #474747;
  --paper-rule: #8a8a8a;

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .8 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.42'/%3E%3C/svg%3E");

  --font-display: "League Gothic", "DIN Condensed", "Arial Narrow", sans-serif;
  --font-frame: "Barlow Condensed", "DIN Condensed", "Arial Narrow", sans-serif;
  --seat: 0em;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-data: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 2px;
  --pitch: 18px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Tokens semánticos del grafo y mapa (contraste >= 3:1 sobre fondos oscuros) */
  --map-project: var(--orange);
  --map-goal: #ffb300;
  --map-skill: #29b6f6;
  --map-result: #4caf50;
  --map-external: var(--text-3);
  --map-edge: var(--edge-line);
  --map-edge-pertenece: var(--edge-line);

  --topbar-height: 64px;
  --bottombar-height: 68px;
  --fab-size: 56px;
  --gutter: 2rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex-shrink: 0; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Rótulo de marco: condensada en mayúsculas (Barlow Condensed autoalojada). */
.frame-type {
  font-family: var(--font-frame);
  text-transform: uppercase;
  letter-spacing: .045em;
  font-weight: 700;
  line-height: 1;
  padding-top: var(--seat);
}

.tabular { font-variant-numeric: tabular-nums; }

/* ===== Carril superior ===== */
.v3-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-height);
  background: var(--ink);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--gutter);
}

/* Regla de fotogramas bajo el carril */
.v3-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -7px;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px var(--pitch));
  pointer-events: none;
}

.v3-header-left { display: flex; align-items: center; gap: 1.5rem; min-width: 0; }

.v3-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1;
  padding-top: var(--seat);
  white-space: nowrap;
}

.v3-brand svg { color: var(--orange); }

.v3-nav-links { display: flex; align-items: stretch; gap: 2px; list-style: none; flex-shrink: 1; min-width: 0; }

.v3-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  padding: 0 .55rem;
  border-radius: var(--r);
  color: var(--text-2);
  text-decoration: none;
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .15s var(--ease-out), background-color .15s var(--ease-out);
}

@media (min-width: 1560px) {
  .v3-nav-item {
    padding: 0 .75rem;
    font-size: 1.12rem;
    gap: .45rem;
  }
}

@media (max-width: 1366px) {
  .v3-header { gap: .5rem; }
  .v3-header-left { gap: .75rem; }
  .v3-nav-links { gap: 1px; }
  .v3-nav-item { padding: 0 .4rem; font-size: .95rem; gap: .25rem; }
  .v3-nav-item .v3-frame-no { display: none; }
}

.v3-nav-item .v3-frame-no {
  font-family: var(--font-data);
  font-size: .72rem;
  letter-spacing: 0;
  color: var(--text-3);
  margin-top: -.1em;
}

.v3-nav-item > span:not(.v3-frame-no):not(.v3-nav-badge) { padding-top: var(--seat); }

.v3-nav-item:hover { color: var(--text); background: var(--spool); }

.v3-nav-item.active { color: var(--ink); background: var(--orange); }
.v3-nav-item.active .v3-frame-no { color: var(--ink); }

/* Bandera doblada: donde estás */
.v3-nav-item.active::after {
  content: '';
  position: absolute;
  top: -10px; right: 8px;
  width: 12px; height: 16px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}

/* «Más»: desplegable nativo con las vistas de consulta */
.v3-nav-more { position: relative; display: flex; }
.v3-nav-more > summary { list-style: none; cursor: pointer; user-select: none; }
.v3-nav-more > summary::-webkit-details-marker { display: none; }
.v3-nav-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 13rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: .35rem;
  background: var(--ink);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
}
.v3-nav-more-menu .v3-nav-item.active::after { display: none; }

.v3-nav-badge {
  font-family: var(--font-data);
  font-size: .75rem;
  letter-spacing: 0;
  min-width: 1.4rem;
  padding: .1rem .3rem;
  text-align: center;
  border: 1px solid currentColor;
  border-radius: var(--r);
  line-height: 1.2;
}

.v3-nav-item.active .v3-nav-badge { border-color: var(--ink); }

.v3-header-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }

.v3-search-btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-height: 44px;
  padding: 0 .75rem;
  background: transparent;
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  color: var(--text-2);
  cursor: pointer;
  font-size: .95rem;
}

.v3-search-btn:hover { color: var(--text); border-color: var(--text-2); }

.v3-kbd {
  display: inline-block;
  font-family: var(--font-data);
  font-size: .78rem;
  line-height: 1.3;
  padding: .05rem .35rem;
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  color: var(--text-2);
  background: var(--ink);
}

/* ===== Botones =====
   Primario: fotograma naranja con perforaciones. Por defecto: marco con borde.
   Destructivo: discreto, nunca compite con la acción que avanza. */
.v3-btn,
.v3-action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  background: transparent;
  color: var(--text);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s var(--ease-out), background-color .15s var(--ease-out), border-color .15s var(--ease-out);
}

.v3-btn > span, .v3-action-btn > span { padding-top: var(--seat); }
.v3-btn:not(:has(> span)), .v3-action-btn:not(:has(> span)) { padding-top: var(--seat); }
.v3-btn:has(> svg:only-child), .v3-action-btn:has(> svg:only-child) { padding-top: 0; }

.v3-action-btn { padding: 0 .75rem; font-size: 1rem; }

.v3-btn:hover, .v3-action-btn:hover { border-color: var(--orange); color: var(--orange); }

.v3-btn:disabled, .v3-action-btn:disabled,
.v3-btn[aria-busy="true"], .v3-action-btn[aria-busy="true"] {
  opacity: .55;
  cursor: progress;
}

.v3-btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--ink);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Perforaciones laterales del fotograma primario */
.v3-btn-primary::before,
.v3-btn-primary::after {
  content: '';
  position: absolute;
  top: 8px; bottom: 8px;
  width: 4px;
  background: repeating-linear-gradient(180deg, var(--ink) 0 4px, transparent 4px 8px);
}
.v3-btn-primary::before { left: 6px; }
.v3-btn-primary::after { right: 6px; }

.v3-btn-primary:hover { background: var(--orange-hi); border-color: var(--orange-hi); color: var(--ink); }

/* Secundarios: marco con perforaciones huecas */
.v3-btn:not(.v3-btn-primary):not(.v3-btn-subtle):not(.v3-btn-icon) { padding-left: 1.4rem; padding-right: 1.4rem; }
.v3-btn:not(.v3-btn-primary):not(.v3-btn-subtle):not(.v3-btn-icon)::before,
.v3-btn:not(.v3-btn-primary):not(.v3-btn-subtle):not(.v3-btn-icon)::after {
  content: '';
  position: absolute;
  top: 9px; bottom: 9px;
  width: 3px;
  background: repeating-linear-gradient(180deg, currentColor 0 3px, transparent 3px 7px);
  opacity: .55;
}
.v3-btn:not(.v3-btn-primary):not(.v3-btn-subtle):not(.v3-btn-icon)::before { left: 7px; }
.v3-btn:not(.v3-btn-primary):not(.v3-btn-subtle):not(.v3-btn-icon)::after { right: 7px; }

/* Cruz de grasa al cerrar un fotograma */
.is-cut {
  background-image:
    linear-gradient(to top right, transparent calc(50% - 2px), var(--orange) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(to bottom right, transparent calc(50% - 2px), var(--orange) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  animation: cut-in .32s var(--ease-out) both;
}
@keyframes cut-in { from { background-size: 0 0, 0 0; } to { background-size: 100% 100%, 100% 100%; } }

.v3-btn-success { border-color: var(--text); color: var(--text); }
.v3-btn-success:hover { background: var(--text); color: var(--ink); border-color: var(--text); }

.v3-btn-danger { border-color: var(--rule); color: var(--text-2); }
.v3-btn-danger:hover { border-color: var(--text-2); color: var(--text); background: var(--spool); }

.v3-btn-subtle { border-color: transparent; color: var(--text-2); }
.v3-btn-subtle:hover { border-color: transparent; background: var(--spool); color: var(--text); }

.v3-btn-icon { padding: 0; width: 44px; }

.v3-link-btn {
  display: inline-flex; align-items: center; gap: .25rem;
  background: none; border: 0; padding: 0 .25rem; min-height: 44px;
  color: var(--orange); cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; font-size: .95rem;
}

/* ===== Contenido ===== */
.v3-main-content {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 5rem;
}

.v3-view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.v3-view-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 6.5vw, 5.5rem);
  line-height: .88;
  letter-spacing: .01em;
  text-transform: uppercase;
  padding-top: var(--seat);
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: .9rem;
  flex-wrap: wrap;
}

.v3-view-title .v3-count { font-size: .5em; color: var(--orange); }

.v3-view-desc { margin-top: .6rem; color: var(--text-2); font-size: .98rem; max-width: 62ch; }

.v3-timecode {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--orange);
  font-size: 1.35rem;
  line-height: 1;
  padding-top: var(--seat);
}

.v3-view-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* Cabecera de sección: rótulo, contador y regla de fotogramas que corre hasta el borde */
.v3-section { margin-bottom: 2.75rem; }

.v3-section-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.v3-section-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.55rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
  padding-top: var(--seat);
  color: var(--text);
  white-space: nowrap;
}

.v3-section-head .v3-count {
  font-family: var(--font-data);
  font-size: .85rem;
  color: var(--orange);
}

.v3-section-head::after {
  content: '';
  flex: 1;
  height: 8px;
  align-self: center;
  background:
    linear-gradient(var(--rule), var(--rule)) left bottom / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px var(--pitch)) left bottom / 100% 6px no-repeat;
}

.v3-section-head .v3-section-tools { order: 3; display: flex; gap: .5rem; }

.v3-section-note { color: var(--text-2); font-size: .95rem; margin: -.4rem 0 1rem; max-width: 70ch; }

/* ===== Pestañas ===== */
.v3-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}
.v3-tabs::-webkit-scrollbar { display: none; }
.v3-tabs + .v3-kanban-board, .v3-tabs + div, .v3-tabs + section { margin-top: 1.25rem; }

.v3-tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  padding: var(--seat) .85rem 0;
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.v3-tab-btn:hover { color: var(--text); }

.v3-tab-btn.active,
.v3-tab-btn[aria-selected="true"] { color: var(--orange); }

.v3-tab-btn.active::after,
.v3-tab-btn[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: .5rem; right: .5rem; bottom: -1px;
  height: 3px;
  background: var(--orange);
}

/* ===== Marcos ===== */
.v3-card {
  position: relative;
  background: var(--charred);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 1.15rem 1.25rem;
  transition: border-color .15s var(--ease-out);
}

.v3-card[data-id], .v3-card.is-link { cursor: pointer; }
.v3-card[data-id]:hover, .v3-card.is-link:hover { border-color: var(--edge-line); }

.v3-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
}

/* ===== Banda de foco: carril naranja con dos ventanas perforadas ===== */
.v3-focus-section {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1.25rem;
  margin: 0 calc(var(--gutter) * -1) 3rem;
  padding: 2.4rem var(--gutter);
  background: var(--grain), var(--orange);
}

.v3-focus-section::before,
.v3-focus-section::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 10px;
  background: repeating-linear-gradient(90deg, transparent 0 5px, var(--ink) 5px 15px, transparent 15px var(--pitch));
  pointer-events: none;
}
.v3-focus-section::before { top: 10px; }
.v3-focus-section::after { bottom: 10px; }

.v3-focus-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 12.5rem;
  background: var(--punched);
  color: var(--paper-ink);
  border-radius: var(--r);
  padding: 1.35rem 1.5rem 1.15rem;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .55);
}

.v3-focus-badge {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--paper-2);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  padding-top: var(--seat);
  margin-bottom: .85rem;
}

.v3-focus-badge .v3-frame-no { font-family: var(--font-data); font-size: .78rem; letter-spacing: 0; color: var(--paper-2); }

/* Bandera de cinta: el foco principal es donde te paraste */
.v3-focus-card:not(.secondary)::after {
  content: '';
  position: absolute;
  top: -14px; right: 1.5rem;
  width: 22px; height: 38px;
  background:
    linear-gradient(160deg, transparent 0 55%, rgba(0, 0, 0, .28) 55% 100%) bottom / 100% 12px no-repeat,
    var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

.v3-focus-title {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--paper-ink);
  text-wrap: balance;
  margin-bottom: .5rem;
}

.v3-focus-card.secondary .v3-focus-title { font-size: clamp(1.1rem, 1.6vw, 1.3rem); }

.v3-focus-body { color: var(--paper-2); font-size: .95rem; margin-bottom: .75rem; }

.v3-focus-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; color: var(--paper-2); font-size: .9rem; }

.v3-focus-empty { color: var(--paper-2); }
.v3-focus-empty strong { display: block; color: var(--paper-ink); font-size: 1.1rem; margin-bottom: .25rem; }

.v3-focus-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: auto;
  padding-top: 1rem;
}

.v3-focus-card .v3-btn-subtle { color: var(--paper-2); }
.v3-focus-card .v3-btn-subtle:hover { background: #ececec; color: var(--paper-ink); }
.v3-focus-card .v3-btn-success { background: var(--paper-ink); border-color: var(--paper-ink); color: var(--punched); padding: 0 1.25rem; }
.v3-focus-card .v3-btn-success:hover { background: #2b2b2b; border-color: #2b2b2b; color: var(--punched); }
.v3-focus-card :focus-visible { outline-color: var(--paper-ink); }
.v3-focus-card .v3-badge { color: var(--paper-2); border-color: var(--paper-rule); }
.v3-focus-card .v3-badge-overdue { background: var(--paper-ink); color: var(--punched); border-color: var(--paper-ink); }

/* ===== Fotogramas de lista ===== */
.v3-item-list { display: flex; flex-direction: column; gap: .5rem; width: 100%; }

.v3-item-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: .7rem 1rem .7rem 2rem;
  background: var(--charred);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
}

/* Columna de perforaciones */
.v3-item-row::before {
  content: '';
  position: absolute;
  left: 9px; top: 6px; bottom: 6px;
  width: 7px;
  background: repeating-linear-gradient(180deg, var(--spool-hi) 0 6px, transparent 6px 11px);
  border-radius: 1px;
}

.v3-item-row:hover { border-color: var(--edge-line); background: #171717; }
.v3-item-row[aria-disabled="true"], .v3-item-row.is-static { cursor: default; }
.v3-item-row.is-static:hover { border-color: var(--rule); background: var(--charred); }

.v3-item-row.focused { border-color: var(--orange); }
.v3-item-row.focused::before { background: repeating-linear-gradient(180deg, var(--orange) 0 6px, transparent 6px 11px); }

.v3-item-left { display: flex; align-items: center; gap: .9rem; min-width: 0; flex: 1; }
.v3-item-content { min-width: 0; flex: 1; }

.v3-item-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v3-item-title.wrap { white-space: normal; text-wrap: pretty; }

.v3-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2rem .9rem;
  margin-top: .2rem;
  color: var(--text-3);
  font-size: .88rem;
}

.v3-item-meta > span { display: inline-flex; align-items: center; gap: .3rem; }
.v3-item-meta svg { width: 14px; height: 14px; }

.v3-item-row.is-done .v3-item-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }

/* ===== Marcas de estado ===== */
.v3-mark { display: inline-flex; align-items: center; justify-content: center; color: var(--orange); }
.v3-mark svg { width: 18px; height: 18px; }
.v3-mark-muted { color: var(--text-3); }

.v3-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15em .45em;
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  color: var(--text-2);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.v3-badge svg { width: 12px; height: 12px; }

.v3-badge-task { }
.v3-badge-idea { border-style: dashed; }
.v3-badge-whys { border-color: var(--orange); color: var(--orange); }
.v3-badge-waiting { border-color: var(--orange); color: var(--orange); }
.v3-badge-overdue { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.v3-badge-done { border-color: var(--rule); color: var(--text-3); }
.v3-badge-solid { background: var(--text); border-color: var(--text); color: var(--ink); }

/* ===== Barra de acciones y menú ===== */
.v3-action-bar { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }

.v3-dropdown { position: relative; display: inline-block; }

.v3-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 260px;
  padding: .35rem;
  background: var(--ink);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .8);
  display: none;
}

.v3-menu.open { display: flex; flex-direction: column; gap: 1px; animation: frame-in .16s var(--ease-out); }

.v3-menu-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-height: 44px;
  padding: .5rem .75rem;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text);
  font-size: .95rem;
  text-align: left;
  cursor: pointer;
}

.v3-menu-item svg { width: 16px; height: 16px; color: var(--text-3); }
.v3-menu-item:hover, .v3-menu-item:focus-visible { background: var(--spool); color: var(--orange); outline: none; }
.v3-menu-item:hover svg, .v3-menu-item:focus-visible svg { color: var(--orange); }

.v3-menu-sep { height: 1px; margin: .3rem .25rem; background: var(--rule); }
.v3-menu-label { padding: .45rem .75rem .2rem; color: var(--text-3); font-size: .8rem; }

/* ===== Decisiones: fotograma con cinta de «te toca» ===== */
.v3-decision-card {
  position: relative;
  background: var(--charred);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 1.6rem 1.25rem 1.1rem;
  margin-bottom: .75rem;
}

.v3-decision-card::before {
  content: '';
  position: absolute;
  left: -1px; right: -1px; top: -1px;
  height: 7px;
  background: var(--grain), var(--orange);
  border-radius: var(--r) var(--r) 0 0;
}

.v3-decision-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}

.v3-decision-title { font-size: 1.1rem; font-weight: 650; line-height: 1.3; color: var(--text); text-wrap: pretty; }

.v3-decision-report {
  background: var(--punched);
  color: var(--paper-ink);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  font-size: .95rem;
  line-height: 1.55;
  max-height: 14rem;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-bottom: 1rem;
  max-width: 78ch;
}

.v3-decision-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

/* ===== Alertas en carril ===== */
.v3-alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem .9rem 1rem;
  border: 1px solid var(--orange);
  border-radius: var(--r);
  background: var(--charred);
  color: var(--text);
  margin-bottom: 1.25rem;
}
.v3-alert svg { color: var(--orange); width: 20px; height: 20px; margin-top: .1rem; }
.v3-alert p { color: var(--text-2); font-size: .95rem; }
.v3-alert strong { color: var(--text); }

/* ===== Lectura de instrumentos (Cerebro) ===== */
.v3-readout {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--charred);
  margin-bottom: 2.5rem;
}

.v3-readout-cell {
  flex: 1 1 9rem;
  padding: .85rem 1.1rem;
  border-right: 1px solid var(--rule);
  min-width: 0;
}
.v3-readout-cell:last-child { border-right: 0; }

.v3-readout-cell { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }

.v3-readout-label {
  color: var(--text-2);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  padding-top: var(--seat);
}

.v3-readout-value {
  font-family: var(--font-data);
  font-size: 1rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  padding: .25rem .45rem;
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
}
.v3-readout-value.hot { background: var(--orange); border-color: var(--orange); color: var(--ink); }

/* Agente en marcha: la película avanza por el carril */
.v3-running { position: relative; overflow: hidden; }
.v3-running::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--orange) 0 10px, transparent 10px var(--pitch));
  animation: film-advance .9s steps(3) infinite;
}

@keyframes film-advance { to { background-position: var(--pitch) 0; } }

/* ===== Estados de carga, vacío y error ===== */
.v3-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
  padding: 2rem 1.5rem;
  border: 1px dashed var(--rule);
  border-radius: var(--r);
  color: var(--text-2);
}

.v3-state-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
  padding-top: var(--seat);
  color: var(--text);
}

.v3-state-error { border-style: solid; border-color: var(--orange); }

.v3-loading {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 2.5rem 0;
  color: var(--text-3);
}

.v3-loading::before {
  content: '';
  width: 90px; height: 12px;
  background: repeating-linear-gradient(90deg, var(--spool-hi) 0 10px, transparent 10px var(--pitch));
  animation: film-advance .6s steps(3) infinite;
}

/* ===== Kanban: cubetas ===== */
.v3-kanban-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.v3-kanban-col {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .85rem;
  background: var(--charred);
  border: 1px solid var(--rule);
  border-radius: var(--r);
}

.v3-kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: .6rem;
  margin-bottom: .25rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1;
}

.v3-kanban-header .v3-count { font-family: var(--font-data); font-size: .85rem; color: var(--orange); }

.kanban-card { background: var(--ink); padding: .8rem .9rem; }
.kanban-card .v3-item-title { white-space: normal; font-size: .95rem; }
.kanban-card.is-done .v3-item-title { color: var(--text-3); text-decoration: line-through; }

.v3-btn-block { width: 100%; }

.v3-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-2);
  font-size: .92rem;
  margin: .5rem 0;
}

.v3-form-error {
  color: var(--orange);
  font-size: .95rem;
  display: flex;
  gap: .4rem;
  align-items: flex-start;
}
.v3-form-error:empty { display: none; }

/* ===== Calendario ===== */
.v3-cal-weekdays,
.v3-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.v3-cal-weekdays {
  margin-bottom: 6px;
  color: var(--text-3);
  font-family: var(--font-frame);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 1rem;
  padding-left: .5rem;
}

.calendar-day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-height: 104px;
  padding: .45rem .5rem;
  background: var(--charred);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.calendar-day-cell:hover { border-color: var(--edge-line); }
.calendar-day-cell.is-empty-slot { background: transparent; border-color: transparent; cursor: default; }
.calendar-day-cell.is-past .v3-cal-day { color: var(--text-3); }

.v3-cal-day { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; line-height: 1; padding-top: var(--seat); font-variant-numeric: tabular-nums; }

.calendar-day-cell.is-today { border-color: var(--orange); }
.calendar-day-cell.is-today .v3-cal-day { color: var(--orange); }
.calendar-day-cell.is-today::after {
  content: '';
  position: absolute;
  top: -1px; right: 10px;
  width: 12px; height: 18px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}

.v3-cal-entry {
  font-size: .8rem;
  line-height: 1.3;
  color: var(--text-2);
  padding: .15rem .35rem .15rem .55rem;
  background: repeating-linear-gradient(180deg, var(--edge-line) 0 2px, transparent 2px 5px) left center / 1px 80% no-repeat;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v3-cal-more { font-size: .8rem; color: var(--text-3); }

.v3-agenda { display: none; }

/* ===== Modales (dialog nativo: foco atrapado, Esc y retorno de foco) ===== */
.v3-modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: hidden;
}

.v3-modal-backdrop[open] { display: flex; align-items: center; justify-content: center; }
.v3-modal-backdrop.is-top[open] { align-items: flex-start; padding-top: 12vh; }
.v3-modal-backdrop::backdrop { background: rgba(0, 0, 0, .74); }

.v3-modal-dialog {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--charred);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  padding: 1.5rem;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .9);
  animation: frame-in .2s var(--ease-out);
}

.v3-modal-dialog.v3-modal-wide { max-width: 760px; }

@keyframes frame-in {
  from { opacity: 0; clip-path: inset(0 0 18% 0); transform: translateY(-6px); }
  to { opacity: 1; clip-path: inset(0 0 0 0); transform: none; }
}

.v3-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.v3-modal-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  line-height: .95;
  padding-top: var(--seat);
  color: var(--text);
}

.v3-modal-sub { margin-top: .4rem; color: var(--text-2); font-size: .95rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }

.v3-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.v3-modal-footer .v3-modal-footer-end { display: flex; gap: .5rem; margin-left: auto; }

/* ===== Formularios ===== */
.v3-form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.1rem; min-width: 0; }

.v3-form-label {
  color: var(--text-2);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  padding-top: var(--seat);
}

.v3-form-hint { color: var(--text-3); font-size: .85rem; }

.v3-input, .v3-select, .v3-textarea {
  width: 100%;
  min-height: 44px;
  padding: .6rem .8rem;
  background: var(--ink);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}

.v3-input::placeholder, .v3-textarea::placeholder { color: var(--text-3); }

.v3-input:focus, .v3-select:focus, .v3-textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 1px var(--orange);
}

.v3-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }

.v3-input[type="date"] { color-scheme: dark; }

.v3-textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

.v3-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .75rem; }
.v3-form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .75rem; }

.v3-segment {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  margin-bottom: 1.25rem;
}

.v3-segment button {
  min-height: 42px;
  border: 0;
  border-radius: 1px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding-top: var(--seat);
  cursor: pointer;
}

.v3-segment button[aria-pressed="true"] { background: var(--orange); color: var(--ink); }

.v3-panel {
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}

.v3-paper {
  background: var(--punched);
  color: var(--paper-ink);
  border-radius: var(--r);
  padding: .9rem 1rem;
  font-size: .95rem;
  white-space: pre-wrap;
  max-height: 12rem;
  overflow-y: auto;
}

.v3-data { font-family: var(--font-data); font-size: .85rem; color: var(--text-3); }

/* ===== Paleta ⌘K ===== */
.v3-palette { padding: 0; overflow: hidden; max-width: 640px; }

.v3-palette-search {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--rule);
}

.v3-palette-search svg { color: var(--text-3); }

.v3-palette-search .v3-input {
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 1.1rem;
  padding-left: 0;
}

.v3-palette-results { max-height: min(420px, 60dvh); overflow-y: auto; padding: .4rem; }

.v3-palette-group {
  padding: .7rem .75rem .3rem;
  color: var(--text-3);
  font-family: var(--font-frame);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 1rem;
  line-height: 1;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 52px;
  padding: .45rem .75rem;
  border-radius: var(--r);
  cursor: pointer;
}

.palette-item[aria-selected="true"] { background: var(--spool); }
.palette-item[aria-selected="true"] .v3-item-title { color: var(--orange); }

.v3-palette-footer {
  display: flex;
  gap: 1rem;
  padding: .55rem 1rem;
  border-top: 1px solid var(--rule);
  color: var(--text-3);
  font-size: .82rem;
}

/* ===== Toasts ===== */
#toast-container {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(460px, calc(100vw - 2rem));
  pointer-events: none;
}

.v3-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 52px;
  padding: .45rem .5rem .45rem 1rem;
  background: var(--ink);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .85);
  color: var(--text);
  font-size: .95rem;
  animation: frame-in .2s var(--ease-out);
}

.v3-toast.is-error { border-color: var(--orange); }

.v3-toast-undo-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: var(--seat) .9rem 0;
  border: 1px solid var(--orange);
  border-radius: var(--r);
  background: transparent;
  color: var(--orange);
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}

.v3-toast-undo-btn:hover { background: var(--orange); color: var(--ink); }

/* ===== Login ===== */
.v3-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
}

.v3-login-frame { width: 100%; max-width: 440px; }
.v3-login-frame .v3-modal-sub { margin-bottom: 1.75rem; }
.v3-login-frame .v3-form-error { margin: -.25rem 0 1rem; }
.v3-login-frame > .v3-form-hint { margin-top: .9rem; }

.v3-login-rail {
  height: 64px;
  margin-bottom: 1.5rem;
  background: var(--grain), var(--orange);
  position: relative;
  border-radius: var(--r);
}

.v3-login-rail::before, .v3-login-rail::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, transparent 0 5px, var(--ink) 5px 13px, transparent 13px var(--pitch));
}
.v3-login-rail::before { top: 8px; }
.v3-login-rail::after { bottom: 8px; }

/* ===== Móvil: tira inferior de fotogramas ===== */
.v3-bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--bottombar-height) + env(safe-area-inset-bottom));
  padding: 10px .5rem env(safe-area-inset-bottom);
  background: var(--ink);
  border-top: 1px solid var(--rule);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 78px; /* el botón Capturar fijo no tapa el fotograma activo */
  /* el fundido al borde avisa de que la tira sigue */
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent);
  scrollbar-width: none;
  gap: 2px;
}
.v3-bottom-nav::-webkit-scrollbar { display: none; }

.v3-bottom-nav::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 2px;
  height: 5px;
  background: repeating-linear-gradient(90deg, transparent 0 5px, var(--spool-hi) 5px 13px, transparent 13px var(--pitch));
  pointer-events: none;
}

.v3-bottom-nav-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  min-width: 66px;
  min-height: 48px;
  padding: .2rem .5rem;
  border-radius: var(--r);
  color: var(--text-2);
  text-decoration: none;
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1;
}

.v3-bottom-nav-item .v3-frame-no { font-family: var(--font-data); font-size: .75rem; letter-spacing: 0; color: var(--text-3); }
.v3-bottom-nav-item.active { background: var(--orange); color: var(--ink); }
.v3-bottom-nav-item.active .v3-frame-no { color: var(--ink); }

/* Capturar vive fijo al inicio de la tira: al alcance del pulgar y sin tapar contenido */
.v3-bottom-capture-wrap {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 .4rem 0 .5rem;
  background: var(--ink);
  box-shadow: 10px 0 12px -6px var(--ink);
}

.v3-bottom-capture {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 48px;
  border: 0;
  border-radius: var(--r);
  background: var(--orange);
  color: var(--ink);
  cursor: pointer;
}

.v3-bottom-capture::before, .v3-bottom-capture::after {
  content: '';
  position: absolute;
  top: 8px; bottom: 8px;
  width: 4px;
  background: repeating-linear-gradient(180deg, var(--ink) 0 4px, transparent 4px 8px);
}
.v3-bottom-capture::before { left: 6px; }
.v3-bottom-capture::after { right: 6px; }

.desktop-only { }
.mobile-only { display: none !important; }

@media (max-width: 1180px) {
  .v3-nav-item { padding: 0 .55rem; }
  .v3-nav-item .v3-frame-no { display: none; }
  .v3-search-btn .v3-search-label { display: none; }
  .v3-header-classic { display: none; }
}

@media (max-width: 1000px) {
  .v3-kanban-board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(280px, 82vw); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .5rem; }
  .v3-kanban-col { scroll-snap-align: start; }
}

@media (max-width: 900px) {
  :root { --gutter: 1rem; --topbar-height: 56px; }

  .v3-nav-links { display: none; }
  .v3-bottom-nav { display: flex; padding-left: 0; }
  .desktop-only { display: none !important; }
  .mobile-only { display: revert !important; }

  .v3-header-actions .v3-search-btn { width: 44px; justify-content: center; padding: 0; }
  #header-capture-btn { display: none; }

  .v3-main-content { padding-top: 1.5rem; padding-bottom: calc(var(--bottombar-height) + 2.5rem); }

  #toast-container { bottom: calc(var(--bottombar-height) + env(safe-area-inset-bottom) + .75rem); }

  .v3-focus-section { grid-template-columns: minmax(0, 1fr); padding: 2rem var(--gutter); gap: 1rem; margin-bottom: 2.25rem; }

  .v3-item-row { flex-direction: column; align-items: stretch; gap: .6rem; }
  .v3-item-left { flex-wrap: wrap; gap: .45rem .6rem; }
  .v3-item-left > .v3-item-content { flex-basis: 100%; }
  .v3-action-bar { flex-wrap: wrap; justify-content: flex-end; }
  .v3-item-title { white-space: normal; }

  .v3-decision-header { flex-direction: column; gap: .5rem; }
}

@media (max-width: 640px) {
  .v3-cal-weekdays, .v3-cal-grid { display: none; }
  .v3-agenda { display: flex; flex-direction: column; gap: .5rem; }
  .v3-view-header { align-items: flex-start; }
  .v3-readout-cell { flex-basis: 45%; border-bottom: 1px solid var(--rule); }
}

@media (max-width: 560px) {
  .v3-modal-backdrop[open] { align-items: flex-end; padding: 0; }
  .v3-modal-backdrop.is-top[open] { align-items: flex-start; padding: .75rem .5rem 0; }
  .v3-modal-dialog { max-height: calc(100dvh - 2.5rem); border-left: 0; border-right: 0; border-bottom: 0; padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  .v3-modal-backdrop.is-top .v3-modal-dialog { border: 1px solid var(--edge-line); }
  .v3-form-grid, .v3-form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .v3-modal-footer .v3-modal-footer-end { width: 100%; }
  .v3-modal-footer .v3-modal-footer-end .v3-btn { flex: 1; }
  .v3-focus-card { padding: 1.15rem 1.1rem 1rem; min-height: 0; }
}

@media (max-width: 380px) {
  .v3-brand .v3-brand-word { font-size: 1.3rem; }
  .v3-action-btn { padding: 0 .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==== cerebro ==== */
.v3-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0 1rem; }
.v3-filters .v3-select { flex: 0 1 auto; min-width: 11rem; }
.v3-filters .v3-input { flex: 1 1 14rem; min-width: 0; }
.v3-chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 .5rem;
  font-family: var(--font-data); font-size: .8rem; color: var(--text);
  border: 1px solid var(--edge-line); border-radius: var(--r); text-decoration: none;
}
.v3-chip:hover, .v3-chip:focus-visible { color: var(--orange); border-color: var(--orange); }
.v3-progress { position: relative; height: 8px; margin: .75rem 0 .5rem; background: var(--spool); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.v3-progress > span { display: block; height: 100%; background: var(--orange); transition: width .3s var(--ease-out); }
.v3-pre {
  margin: .5rem 0 0; padding: .6rem .75rem; max-height: 16rem; overflow: auto;
  font-family: var(--font-data); font-size: .8rem; line-height: 1.45; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word; background: var(--ink); border: 1px solid var(--rule); border-radius: var(--r);
}
.v3-pre.is-error { color: var(--text); border-color: var(--orange); }
.v3-panel > .v3-pre { margin: 0; border: 0; padding: 0; background: transparent; max-height: 28rem; color: var(--text); font-size: .9rem; }
.v3-details { margin-top: .75rem; }
.v3-details > summary {
  cursor: pointer; min-height: 44px; display: flex; align-items: center;
  font-family: var(--font-frame); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
}
.v3-details > summary:hover { color: var(--orange); }
.v3-details[open] > summary { color: var(--text); }
.revision-list { margin: .25rem 0 .75rem; padding-left: 1.1rem; display: grid; gap: .35rem; overflow-wrap: anywhere; }
.revision-list .replicate-btn { margin-left: .5rem; vertical-align: middle; }
.v3-timeline { list-style: none; margin: .25rem 0 0; padding: 0 0 0 .75rem; border-left: 1px solid var(--rule); }
.v3-timeline > li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .35rem 0; font-size: .92rem; }
.v3-timeline > li .v3-form-hint { flex-basis: 100%; }
.brain-task-row { cursor: pointer; }
.brain-task-row:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.brain-task-title { max-width: 70ch; }
@media (max-width: 640px) {
  .v3-filters .v3-select { flex: 1 1 100%; }
}
/* cerebro: ajustes tras revisión visual */
.v3-filters .v3-select { width: auto; flex: 1 1 12rem; }
.v3-panel > .v3-pre { font-family: var(--font-body); }
.v3-view-desc.brain-task-title { font-size: 1.3rem; font-weight: 600; line-height: 1.25; color: var(--text); margin: .35rem 0 .5rem; }
.v3-details > summary::before { content: '+'; font-family: var(--font-data); color: var(--orange); margin-right: .5rem; }
.v3-details[open] > summary::before { content: '−'; }

/* ==== planificar ==== */
/* Tablero: arrastre y alternativa de teclado */
.kanban-card { cursor: grab; }
.kanban-card.dragging { opacity: .5; cursor: grabbing; }
.kanban-card .plan3-move, .kanban-card .plan3-week { margin-top: .6rem; font-size: .92rem; }
.kanban-card .v3-item-title a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.kanban-card .v3-item-title a:hover { color: var(--orange); }
.v3-kanban-col.drag-over { border-color: var(--orange); }

/* Roadmap: proyectos × semanas. Solo este contenedor puede desbordar en horizontal. */
.plan3-roadmap { max-width: 100%; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); }
.plan3-roadmap table { border-collapse: collapse; width: max-content; min-width: 100%; }
.plan3-roadmap th, .plan3-roadmap td { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); vertical-align: top; text-align: left; }
.plan3-roadmap thead th {
  position: sticky; top: 0; z-index: 2;
  min-width: 190px; padding: .7rem .8rem;
  background: var(--spool); color: var(--text-2);
  font-family: var(--font-frame); font-weight: 700; font-size: 1rem;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.plan3-roadmap thead th.is-current { color: var(--orange); border-bottom: 2px solid var(--orange); }
.plan3-roadmap th.plan3-sticky {
  position: sticky; left: 0; z-index: 3;
  width: 220px; min-width: 220px; padding: .8rem;
  background: var(--charred); border-right: 1px solid var(--edge-line);
}
.plan3-roadmap thead th.plan3-sticky { background: var(--spool); }
.plan3-roadmap td.plan3-cell { min-width: 230px; padding: .6rem; background: var(--ink); }
.plan3-roadmap td.plan3-cell.drag-over { outline: 1px solid var(--orange); outline-offset: -1px; }
.plan3-roadmap td.plan3-cell > .kanban-card + .kanban-card { margin-top: .5rem; }
.plan3-row-name { display: block; font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
a.plan3-row-name:hover { color: var(--orange); }
.plan3-next { margin-top: .4rem; color: var(--text-3); font-size: .85rem; }
.plan3-card-ro { cursor: default; border-style: dashed; }

/* Formaciones y grupos vinculados */
.plan3-formacion { display: flex; flex-direction: column; gap: .75rem; }
.plan3-formacion-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.plan3-link-form { padding: .85rem 1rem; background: var(--ink); border: 1px solid var(--rule); border-radius: var(--r); }
.plan3-link-form .v3-form-group { margin-bottom: .6rem; }
.plan3-cohorts { display: flex; flex-direction: column; gap: .5rem; }
.plan3-cohort { margin-bottom: 0; }
.plan3-cohort-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.plan3-meter-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.plan3-meter { flex: 1; height: 10px; appearance: none; border: 1px solid var(--rule); border-radius: var(--r); background: var(--charred); }
.plan3-meter::-webkit-progress-bar { background: var(--charred); }
.plan3-meter::-webkit-progress-value { background: var(--orange); }
.plan3-meter::-moz-progress-bar { background: var(--orange); }
.plan3-members { list-style: none; margin: .75rem 0 0; padding: 0; max-height: 22rem; overflow-y: auto; border-top: 1px solid var(--rule); }
.plan3-members li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; min-height: 44px; padding: .35rem 0; border-bottom: 1px solid var(--rule); }
.plan3-member-name { font-size: .95rem; overflow-wrap: anywhere; }
.plan3-members .v3-item-meta { margin-top: 0; }

@media (max-width: 900px) {
  .plan3-roadmap th.plan3-sticky { width: 170px; min-width: 170px; }
  .plan3-roadmap td.plan3-cell { min-width: 200px; }
  .plan3-formacion-head { flex-direction: column; }
  .plan3-formacion-head .v3-action-bar { width: 100%; }
}
.v3-view-tools .plan3-project { width: auto; min-width: 200px; max-width: 100%; }

/* ==== bandeja-hoy ==== */
.bh-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem; }
.bh-row-end { justify-content: flex-end; }

/* Fila + informe del agente forman un solo bloque de la lista. */
.v3-item-group { display: flex; flex-direction: column; min-width: 0; }
.v3-item-group:has(.bh-report) > .v3-item-row { border-radius: var(--r) var(--r) 0 0; border-bottom-color: transparent; }
.bh-report {
  margin-top: 0;
  padding: 0 1rem .85rem 2rem;
  background: var(--charred);
  border: 1px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 var(--r) var(--r);
}
.bh-report > summary { gap: .45rem; }
@media (max-width: 480px) {
  .bh-report { padding-left: 1rem; }
  .bh-row-end { justify-content: stretch; }
  .bh-row-end > .v3-btn { flex: 1 1 auto; }
}

/* ==== proyectos ==== */
a.project-card {
  display: flex; flex-direction: column; gap: .35rem;
  color: inherit; text-decoration: none;
}
a.project-card:hover { border-color: var(--edge-line); }
a.project-card:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
a.project-card .v3-clamp-2 { margin: .15rem 0 0; color: var(--text-2); font-size: .95rem; }

.unassigned-goal-card { display: flex; flex-direction: column; gap: .35rem; }
.unassigned-goal-card .v3-action-bar { margin-top: .35rem; justify-content: flex-start; }
.unassigned-goal-card .v3-form-group { margin: .25rem 0 0; }

.proposal-group .v3-filters { margin: .5rem 0 .75rem; }

.v3-subhead {
  display: flex; align-items: center; gap: .5rem;
  margin: 1.5rem 0 .5rem;
  font-family: var(--font-frame); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  font-size: 1.02rem; color: var(--text-2);
}
.v3-subhead:first-child { margin-top: .25rem; }
.v3-subhead .v3-count { color: var(--orange); font-family: var(--font-data); font-size: .8rem; letter-spacing: 0; }

.project-mini-cal.v3-cal-grid .calendar-day-cell { min-height: 78px; }
.v3-cal-count {
  position: absolute; top: .45rem; right: .5rem;
  font-family: var(--font-data); font-size: .7rem; color: var(--orange);
}

@media (max-width: 640px) {
  /* El calendario general se sustituye por su agenda; el del proyecto se queda, compacto. */
  .v3-cal-weekdays.project-mini-cal, .v3-cal-grid.project-mini-cal { display: grid; }
  .project-mini-cal.v3-cal-weekdays { font-size: .85rem; padding-left: 0; }
  .project-mini-cal.v3-cal-grid { gap: 3px; }
  .project-mini-cal.v3-cal-grid .calendar-day-cell { min-height: 44px; padding: .3rem .2rem; align-items: center; }
  .project-mini-cal .v3-cal-entry, .project-mini-cal .v3-cal-more { display: none; }
  .project-mini-cal .v3-cal-day { font-size: 1.05rem; }
  .project-mini-cal .v3-cal-count { position: static; font-size: .65rem; }
}

/* ==== resultados-calendario ==== */
.v3-view-tools .v3-segment { margin-bottom: 0; width: auto; }
.v3-view-tools .v3-segment button { padding-left: .9rem; padding-right: .9rem; }

/* Cabecera de celda: número de día a la izquierda, carga del día a la derecha */
.v3-cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.v3-cal-load {
  font-family: var(--font-data);
  font-size: .78rem;
  line-height: 1;
  color: var(--text-3);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: .15em .35em;
}
.calendar-day-cell.is-today .v3-cal-load { border-color: var(--orange); color: var(--orange); }

/* Barra de proyecto: tramo start_date..target_date que cruza el día */
.v3-cal-bar {
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--spool);
  border-left: 3px solid var(--edge-line);
  border-radius: 1px;
  padding: .12rem .35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.v3-cal-bar:hover { color: var(--orange); border-left-color: var(--orange); }

.v3-cal-entry { cursor: pointer; display: flex; align-items: center; gap: .25rem; }
.v3-cal-entry svg { flex: none; width: 12px; height: 12px; }
.v3-cal-entry.is-overdue { color: var(--text); background-image: none; border-left: 2px solid var(--orange); padding-left: .35rem; }
.v3-cal-entry.is-dragging { opacity: .45; }
.calendar-day-cell.is-drop-target { border-color: var(--orange); background: var(--spool); }
.calendar-day-cell[role="button"]:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* Semana: menos columnas de contenido por celda, así que caben más líneas */
.v3-cal-grid.is-week .calendar-day-cell { min-height: 220px; }

/* Selector de fecha en filas de agenda y del modal del día */
.cal-date-input { width: auto; min-width: 9.5rem; min-height: 44px; }

/* El desplegable «⋯» de una fila de resultado no debe recortarse contra el borde */
.result-row .v3-menu { right: 0; }

@media (max-width: 900px) {
  .cal-date-input { flex: 1 1 100%; }
}
@media (max-width: 620px) {
  .v3-section-head.plan3-head { flex-wrap: wrap; }
  .v3-section-head.plan3-head .v3-section-tools { width: 100%; }
  .v3-section-head.plan3-head .v3-section-tools > * { width: 100%; }
}

/* ==== mapa ==== */
.v3-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
  font-family: var(--font-frame);
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
}
.v3-breadcrumb-link {
  color: var(--text-2);
  text-decoration: none;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.v3-breadcrumb-link:hover { color: var(--orange); }
.v3-breadcrumb-sep { color: var(--edge-line); }
.v3-breadcrumb-current { color: var(--orange); font-weight: 700; }

/* Universo & Proyecto en SVG */
.map-project-wrapper { display: flex; flex-direction: column; gap: 1rem; }
.map-canvas-container {
  position: relative;
  width: 100%;
  min-height: 520px;
  background: var(--charred);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.map-canvas-container.is-dragging { cursor: grabbing; }
.map-canvas-container:focus-visible { outline: 2px solid var(--orange); }
.map-svg-canvas {
  width: 100%;
  height: 520px;
  display: block;
}


/* Nodos SVG */
.map-node {
  cursor: pointer;
  outline: none;
  transition: opacity .15s ease;
}
.map-node .node-box {
  fill: var(--spool);
  stroke: var(--edge-line);
  stroke-width: 1.5px;
  transition: stroke .15s ease, fill .15s ease;
}
.map-node.node-external .node-box {
  stroke-dasharray: 4, 4;
  stroke: var(--text-3);
  fill: var(--charred);
}
.map-node.node-aggregate .node-box,
.map-node.node-overflow_aggregate .node-box {
  stroke: var(--text-2);
  fill: var(--spool-hi);
}
.map-node.node-overflow_aggregate .node-box {
  stroke-dasharray: 2, 2;
}
.map-node.node-project .node-box { stroke: var(--orange); }
.map-node.node-skill .node-box { stroke: var(--map-skill); }
.map-node.node-goal .node-box { stroke: var(--map-goal); }
.map-node.node-result .node-box { stroke: var(--map-result); }

.map-node .node-type-label {
  font-family: var(--font-frame);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  fill: var(--text-2);
}
.map-node .node-title {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  fill: var(--text);
}
.map-node .node-meta-share {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 700;
  fill: var(--orange);
}
.map-node .node-meta-count {
  font-family: var(--font-data);
  font-size: 10px;
  fill: var(--text-3);
}
.map-node .node-meta-lc {
  font-family: var(--font-data);
  font-size: 10px;
  text-transform: uppercase;
  fill: var(--text-3);
}

.map-node:hover .node-box, .map-node:focus-visible .node-box {
  stroke: var(--orange-hi);
  fill: var(--spool-hi);
  stroke-width: 2.5px;
}

/* Aristas SVG */
.map-edge-line {
  stroke: var(--edge-line);
  stroke-width: 1.5px;
  fill: none;
  transition: stroke .15s ease, stroke-width .15s ease;
}
.map-edge-label {
  font-family: var(--font-data);
  font-size: 10px;
  fill: var(--text-2);
  text-anchor: middle;
}
.edge-depende-de .map-edge-line { stroke: var(--orange); }
.edge-vinculada .map-edge-line { stroke: var(--text-2); stroke-dasharray: 4, 3; }
.edge-produce .map-edge-line { stroke: var(--map-result); }
.edge-objetivo .map-edge-line { stroke: var(--map-goal); }
.edge-usa-skill .map-edge-line { stroke: var(--map-skill); stroke-dasharray: 3, 3; }
.edge-pertenece .map-edge-line { stroke: var(--edge-line); }

/* Traza y atenuación */
.map-svg-canvas.is-tracing .map-node.is-dimmed { opacity: 0.18; }
.map-svg-canvas.is-tracing .map-node.is-highlighted .node-box {
  stroke: var(--orange-hi);
  stroke-width: 2.5px;
  fill: var(--spool-hi);
}
.map-svg-canvas.is-tracing .map-edge-group.is-dimmed { opacity: 0.12; }
.map-svg-canvas.is-tracing .map-edge-group.is-highlighted .map-edge-line {
  stroke: var(--orange-hi);
  stroke-width: 2.5px;
}
.map-node.is-search-dimmed { opacity: 0.15; }
.map-node.is-search-highlighted .node-box { stroke: var(--orange-hi); stroke-width: 2.5px; }

/* Leyenda con contraste >= 3:1 */
.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--charred);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  font-size: .82rem;
  color: var(--text-2);
}
.legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.legend-swatch {
  width: 12px; height: 12px;
  border-radius: 2px;
  border: 1px solid var(--edge-line);
}
.swatch-area { background: var(--charred); border-color: var(--edge-line); }
.swatch-project { background: var(--spool); border-color: var(--orange); }
.swatch-goal { background: var(--spool); border-color: var(--map-goal); }
.swatch-skill { background: var(--spool); border-color: var(--map-skill); }
.swatch-brain_task { background: var(--spool); border-color: var(--edge-line); }
.swatch-item_task { background: var(--spool); border-color: var(--edge-line); }
.swatch-idea { background: var(--spool); border-color: var(--edge-line); }
.swatch-result { background: var(--spool); border-color: var(--map-result); }
.swatch-external_task { background: var(--charred); border-color: var(--text-3); border-style: dashed; }
.swatch-closed_tasks_aggregate { background: var(--spool-hi); border-color: var(--text-2); }
.swatch-overflow_aggregate { background: var(--spool-hi); border-color: var(--text-2); border-style: dashed; }

.legend-line {
  width: 16px; height: 2px;
  background: var(--edge-line);
}
.line-depende-de { background: var(--orange); }
.line-vinculada { background: var(--text-2); }
.line-produce { background: var(--map-result); }
.line-objetivo { background: var(--map-goal); }
.line-usa-skill { background: var(--map-skill); }

/* Vista móvil / árbol */
.map-mobile-list { display: none; }
.map-mobile-card {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: 1rem;
  background: var(--spool);
  border: 1px solid var(--edge-line);
}
.map-mobile-card.is-external { border-style: dashed; }
.map-mobile-card-head {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  flex-wrap: wrap;
}
.map-mobile-rel {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .82rem;
  border-top: 1px solid var(--rule);
  padding-top: .5rem;
}
.map-rel-label { color: var(--text-3); font-weight: 600; }
.map-rel-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.map-rel-chip {
  padding: .35rem .65rem;
  background: var(--charred);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  color: var(--text);
  text-decoration: none;
  font-size: .8rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.map-rel-chip:hover { border-color: var(--orange); color: var(--text); }

/* Detalle de Nodo */
.map-node-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.map-node-main-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--spool);
  border: 1px solid var(--rule);
}
.map-node-props { display: flex; flex-direction: column; gap: .75rem; }
.map-prop-row { display: flex; align-items: center; gap: .75rem; }
.map-prop-row-block { display: flex; flex-direction: column; gap: .35rem; }
.map-prop-name { color: var(--text-3); font-size: .85rem; font-weight: 600; min-width: 110px; }
.map-prop-text { color: var(--text); font-size: .95rem; line-height: 1.45; }
.map-node-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: .5rem; }
.map-node-relations-col { display: flex; flex-direction: column; gap: 1rem; }
.map-rel-card {
  padding: 1.25rem;
  background: var(--spool);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.map-rel-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.map-rel-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .5rem;
  background: var(--charred);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  min-height: 44px;
}
.map-rel-link { color: var(--text); text-decoration: none; flex: 1; font-weight: 600; font-size: .9rem; }
.map-rel-link:hover { color: var(--orange); }
.map-empty-text { color: var(--text-3); font-size: .85rem; font-style: italic; }

.map-agg-tasks-card {
  margin-top: .75rem;
  padding: 1rem;
  background: var(--charred);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
}

@media (max-width: 800px) {
  .map-node-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .map-canvas-container { display: none; }
  .map-mobile-list { display: flex; flex-direction: column; gap: .75rem; }
}

/* ==== ficha de retorno y timeline de proyecto ==== */
.project-return-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: .75rem;
}

.return-card {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: 1.1rem 1.2rem;
  background: var(--spool);
  border: 1px solid var(--edge-line);
  border-radius: var(--r);
  min-height: 120px;
}

.return-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.return-card-title h3 {
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0;
}

.return-progress-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin-top: .25rem;
}

.return-progress-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--orange);
}

.return-version-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.return-card-desc {
  color: var(--text);
  font-size: .95rem;
  line-height: 1.4;
  margin: 0;
}

.return-changed-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.return-changed-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  font-size: .9rem;
}

.return-changed-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.return-next-step {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .95rem;
  color: var(--text);
}

.return-step-label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--text-2);
  font-size: .85rem;
}

.return-open-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .85rem;
  font-size: .9rem;
  color: var(--text-2);
  margin-top: auto;
}

.return-decisions-body {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  font-size: .9rem;
}

.return-decision-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem;
}

.project-milestones-section {
  margin-top: 1.5rem;
}

.project-section-fold > summary {
  padding: .4rem 0;
}
.project-section-fold > summary .v3-count { margin-left: .5rem; }
.project-group-fold { margin-top: .75rem; }
.project-group-fold > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }

@media (max-width: 640px) {
  .project-return-grid {
    grid-template-columns: 1fr;
  }
}

/* ==== Brain Task Detail: Summary ==== */
.task-summary-panel {
  border-left: 3px solid var(--orange);
  background: var(--spool);
  margin-bottom: 1.25rem;
}

.task-summary-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
}

.task-summary-missing {
  color: var(--text-2);
  font-size: .875rem;
  margin-top: .35rem;
  line-height: 1.4;
}

.task-summary-disclaimer {
  color: var(--text-3);
  font-size: .85rem;
  margin-top: .4rem;
}

.task-note-details {
  margin-bottom: 1.25rem;
}

.task-note-details > summary {
  padding: .5rem 0;
  font-family: var(--font-frame);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ==== Hoy: Desde tu última visita ==== */
.since-last-visit-section {
  margin-bottom: 1.5rem;
}

/* ==== mapa: universo por atención ==== */
.map-universe-card { display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: inherit; }
.map-universe-card.needs-attention { border-color: var(--orange); }
.map-att-row { display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-size: .875rem; color: var(--text-2); }
.map-att.is-failed, .map-att.is-blocked { color: var(--orange); font-weight: 600; }
.map-att.is-review { color: var(--text); font-weight: 600; }
.map-cross-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.map-cross-links li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem 0; }
.map-cross-kind { color: var(--text-2); font-size: .875rem; }
.map-area { margin-top: 2rem; }
.map-area-count { color: var(--text-2); font-size: .875rem; }
.map-area .v3-grid + .map-dormant-list { margin-top: 1rem; }
.map-dormant-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); column-gap: 1.5rem; }
.map-dormant-list li { display: flex; justify-content: space-between; gap: 1rem; min-height: 44px; align-items: center; border-bottom: 1px solid var(--edge-line); }
.map-dormant-list a { color: inherit; }

.map-series { margin-top: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--edge-line); }
.map-series-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem; margin-bottom: .5rem; }
.map-series-head a { color: inherit; font-weight: 600; }
.map-series-pieces { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .375rem; }
.map-series-pieces li { padding: .125rem .5rem; border: 1px solid var(--edge-line); border-radius: 2px; font-size: .875rem; color: var(--text-2); overflow-wrap: anywhere; }

/* ==== clasificar histórico ==== */
.history-classification { margin-top: 2.75rem; padding-top: .75rem; border-top: 1px solid var(--rule); }
.history-batch-preview { max-height: min(50dvh, 32rem); overflow-y: auto; overscroll-behavior: contain; }
.history-batch-preview .v3-section { margin: 1rem 0; }
.history-batch-preview:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }


/* ==== Navegación H5 ==== */
.v3-tabs a.v3-tab-btn { display: inline-flex; align-items: center; text-decoration: none; }
.v3-tabs a[aria-current="page"] { color: var(--orange); border-bottom-color: var(--orange); }
#history-list { margin: 1rem 0; }
#history-list a { text-decoration: none; color: inherit; }
@media (max-width: 900px) {
  .v3-bottom-nav { overflow: visible; mask-image: none; -webkit-mask-image: none; scroll-snap-type: none; padding-left: .5rem; }
  .v3-bottom-nav > .v3-bottom-nav-item { flex: 1; min-width: 0; padding-inline: .25rem; font-size: .95rem; }
  .v3-mobile-more { flex: 0 0 44px; }
  .v3-mobile-more > summary { min-width: 44px; padding-inline: 0; }
  .v3-mobile-more .v3-nav-more-menu { position: fixed; top: auto; bottom: calc(var(--bottombar-height) + env(safe-area-inset-bottom)); right: .5rem; }
  #header-capture-btn { display: inline-flex; padding-inline: .65rem; }
}

/* ==== Cerebro H5 ==== */
.brain-readout > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-family: var(--font-frame); text-transform: uppercase; }
@media (min-width: 901px) { .brain-readout > summary { display: none; } }
.brain-recent-done { margin-top: 1rem; }
