/* TV View — isolated 1920×1080 R&D wallboard drawn as a three-week funnel. */

/* Self-hosted so the wallboard keeps its type on an offline signage PC. */
@font-face {
  font-family: "Poppins TV";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/poppins-500.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins TV";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/poppins-600.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins TV";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/poppins-700.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins TV";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/poppins-800.woff2") format("woff2");
}

.funnel-tv {
  --funnel-navy: #0b2237;
  --funnel-teal: #006b7f;
  --funnel-cyan: #54b6c8;
  --funnel-gold: #e0a345;
  --funnel-danger: #c73e38;
  --funnel-card-h: 168px;
  /* Auto-fit escalation: padding gives way first, the milestone name second. */
  --funnel-pad-scale: 1;
  --funnel-name-scale: 1;
  --tv-design-w: 1920;
  --tv-design-h: 1080;

  position: relative;
  display: none;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: #fff;
  font-family: "Poppins TV", Poppins, "Avenir Next", Montserrat, "Segoe UI", system-ui, sans-serif;
  background: #030c15;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.funnel-tv__viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Fixed 1080p artboard; JS scales uniformly to the display (no stretch). */
.funnel-tv__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 1920px;
  height: 1080px;
  padding: 24px 40px 14px;
  transform-origin: center center;
  background:
    linear-gradient(90deg, rgba(3, 12, 21, 0.94) 0%, rgba(5, 22, 34, 0.82) 30%, rgba(4, 24, 34, 0.48) 62%, rgba(2, 12, 20, 0.24) 100%),
    linear-gradient(180deg, rgba(2, 13, 22, 0.32), rgba(2, 13, 22, 0.58)),
    url("/static/img/cardo-riders-funnel-bg.jpg") center center / cover no-repeat;
}

.funnel-tv__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 79% 43%, transparent 0 15%, rgba(3, 15, 24, 0.08) 37%, rgba(3, 15, 24, 0.35) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 22%);
}

body.app-view-funnel-tv .dashboard,
body.app-view-funnel-tv .portfolio-view,
body.app-view-funnel-tv #mission-control,
body.app-view-funnel-tv .mc {
  display: none !important;
}

body.app-view-funnel-tv .funnel-tv {
  display: block;
}

.funnel-tv__header,
.funnel-tv__board,
.funnel-tv__footer {
  position: relative;
  z-index: 1;
}

.funnel-tv__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 24px;
  min-height: 92px;
  padding: 0 8px;
  position: relative;
  z-index: 1;
}

.funnel-tv__brand {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.2vw, 22px);
  min-width: 0;
}

.funnel-tv__logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.38));
}

.funnel-tv__kicker {
  margin: 0 0 2px;
  color: #76d1df;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.funnel-tv__title {
  margin: 0;
  color: #fff;
  font-size: 46px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-shadow: 0 3px 15px rgba(0, 0, 0, 0.42);
}

.funnel-tv__subtitle {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.015em;
}

.funnel-tv__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.funnel-tv__updated {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
}

.funnel-tv__controls {
  display: flex;
  gap: 8px;
}

.funnel-tv__btn {
  height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  color: #fff;
  background: rgba(5, 28, 40, 0.68);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.funnel-tv__btn:hover {
  border-color: #75ccda;
  background: rgba(8, 68, 83, 0.86);
}

.funnel-tv__btn--story {
  border-color: rgba(125, 255, 180, 0.62);
  color: #a7ffca;
  background: rgba(17, 95, 65, 0.55);
}

.funnel-tv__btn--story[aria-pressed="true"] {
  border-color: #a7ffca;
  color: #082619;
  background: #a7ffca;
}

.funnel-tv[data-squeeze="1"] {
  --funnel-pad-scale: 0.78;
}

.funnel-tv[data-squeeze="2"] {
  --funnel-pad-scale: 0.72;
  --funnel-name-scale: 0.96;
}

/* Last resort for a week that is both busy and full of rescheduled items. */
.funnel-tv[data-squeeze="3"] {
  --funnel-pad-scale: 0.62;
  --funnel-name-scale: 0.9;
}

.funnel-tv[data-squeeze="3"] .funnel-owner,
.funnel-tv[data-squeeze="3"] .funnel-receiver,
.funnel-tv[data-squeeze="3"] .funnel-delay {
  height: clamp(13px, calc(var(--funnel-card-h) * 0.155), 22px);
  font-size: clamp(0.5rem, calc(var(--funnel-card-h) * 0.068), 0.68rem);
}

.funnel-tv[data-squeeze="3"] .funnel-flow {
  padding-top: 0;
  padding-bottom: 0;
}

/* Three stages: wide at “now” (left / top), narrowing toward the horizon (right). */
.funnel-tv__board {
  display: grid;
  grid-template-columns: 720px 580px 500px;
  column-gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  isolation: isolate;
  position: relative;
  z-index: 1;
}

.funnel-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: clamp(16px, 1.8vh, 22px) clamp(18px, 1.25vw, 28px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
  backdrop-filter: blur(6px) saturate(110%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 14px 34px rgba(0, 0, 0, 0.16);
  filter: drop-shadow(2px 0 5px rgba(98, 166, 183, 0.2));
}

/* Funnel: each stage is shorter and narrower toward the right; slanted edges interlock. */
.funnel-stage--week3,
.funnel-stage--next {
  color: var(--funnel-navy);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
  box-shadow: none;
}

.funnel-stage--week3 {
  z-index: 1;
  align-self: center;
  height: 72%;
  margin-left: clamp(-36px, -2.4vw, -24px);
  padding-left: clamp(28px, 2vw, 40px);
  padding-right: clamp(14px, 1.2vw, 22px);
  background: rgba(232, 239, 244, 0.3);
  border-color: rgba(255, 255, 255, 0.55);
  /* Narrowest stage: slants in on both left (from prior week) and right (funnel tip). */
  clip-path: polygon(34px 0, 100% 0, calc(100% - 22px) 100%, 0 100%);
}

.funnel-stage--next {
  z-index: 2;
  align-self: center;
  height: 86%;
  margin-left: clamp(-36px, -2.4vw, -24px);
  padding-left: clamp(32px, 2.2vw, 44px);
  padding-right: clamp(22px, 1.6vw, 34px);
  color: #083044;
  background: rgba(154, 198, 214, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
  clip-path: polygon(40px 0, 100% 0, calc(100% - 34px) 100%, 0 100%);
}

.funnel-stage--week3 .funnel-empty,
.funnel-stage--next .funnel-empty {
  color: #fff;
  opacity: 0.92;
}

.funnel-stage--current {
  z-index: 3;
  padding-right: clamp(28px, 2vw, 40px);
  color: #fff;
  background:
    radial-gradient(circle at 30% 0%, rgba(84, 182, 200, 0.28), transparent 46%),
    linear-gradient(
      90deg,
      rgba(3, 55, 70, 0.96) 0%,
      rgba(4, 63, 79, 0.92) 62%,
      rgba(4, 60, 75, 0.72) 100%
    );
  border-color: transparent;
  /* Funnel mouth: full width at the top, narrows toward the bottom-right. */
  clip-path: polygon(0 0, 100% 0, calc(100% - 44px) 100%, 0 100%);
  box-shadow:
    inset 0 0 0 3px #39f58a,
    inset 0 0 22px rgba(57, 245, 138, 0.55);
  filter:
    drop-shadow(3px 0 0 #39f58a)
    drop-shadow(-3px 0 0 #39f58a)
    drop-shadow(0 3px 0 #39f58a)
    drop-shadow(0 -3px 0 #39f58a)
    drop-shadow(0 0 8px rgba(57, 245, 138, 1))
    drop-shadow(0 0 20px rgba(34, 197, 94, 0.9));
  animation: funnel-frame-glow 2.8s ease-in-out infinite;
}

@keyframes funnel-frame-glow {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 2px rgba(57, 245, 138, 0.55),
      inset 0 0 10px rgba(57, 245, 138, 0.22);
    filter:
      drop-shadow(2px 0 0 rgba(57, 245, 138, 0.55))
      drop-shadow(-2px 0 0 rgba(57, 245, 138, 0.55))
      drop-shadow(0 2px 0 rgba(57, 245, 138, 0.55))
      drop-shadow(0 -2px 0 rgba(57, 245, 138, 0.55))
      drop-shadow(0 0 4px rgba(57, 245, 138, 0.45))
      drop-shadow(0 0 10px rgba(34, 197, 94, 0.28));
  }

  50% {
    box-shadow:
      inset 0 0 0 4px #7dffb4,
      inset 0 0 32px rgba(125, 255, 180, 0.95);
    filter:
      drop-shadow(4px 0 0 #7dffb4)
      drop-shadow(-4px 0 0 #7dffb4)
      drop-shadow(0 4px 0 #7dffb4)
      drop-shadow(0 -4px 0 #7dffb4)
      drop-shadow(0 0 16px rgba(125, 255, 180, 1))
      drop-shadow(0 0 36px rgba(57, 245, 138, 0.95));
  }
}

@media (prefers-reduced-motion: reduce) {
  .funnel-stage--current {
    animation: none;
  }
}

.funnel-stage__glass {
  display: none;
}

.funnel-stage__header,
.funnel-stage--week3 .funnel-stage__cards,
.funnel-stage--next .funnel-stage__cards {
  position: relative;
  z-index: 2;
}

.funnel-stage--current .funnel-stage__eyebrow {
  color: #8fe3ef;
  opacity: 1;
}

.funnel-stage--current .funnel-card {
  box-shadow:
    inset 4px 0 0 #0f8c9c,
    0 8px 18px rgba(2, 20, 32, 0.28);
}

.funnel-stage__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 10px;
  margin-bottom: clamp(10px, 1.3vh, 16px);
  padding-bottom: clamp(8px, 0.9vh, 12px);
  border-bottom: 1px solid currentColor;
}

.funnel-stage--week3 .funnel-stage__header {
  padding-left: 18px;
  border-bottom-color: rgba(255, 255, 255, 0.28);
}

.funnel-stage--next .funnel-stage__header {
  padding-right: 28px;
  border-bottom-color: rgba(255, 255, 255, 0.28);
}

.funnel-stage--current .funnel-stage__header {
  border-bottom-color: rgba(255, 255, 255, 0.24);
}

.funnel-stage__eyebrow {
  margin: 0 0 1px;
  font-size: clamp(0.56rem, 0.58vw, 0.72rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.65;
}

.funnel-stage__title {
  margin: 0;
  font-size: clamp(1.08rem, 1.45vw, 1.65rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.funnel-stage--week3 .funnel-stage__eyebrow,
.funnel-stage--next .funnel-stage__eyebrow {
  color: #8fe3ef;
  opacity: 1;
  text-shadow: 0 1px 6px rgba(3, 31, 43, 0.6);
}

.funnel-stage--week3 .funnel-stage__title,
.funnel-stage--next .funnel-stage__title {
  color: #fff;
  text-shadow: 0 2px 8px rgba(3, 31, 43, 0.55);
}

.funnel-stage--current .funnel-stage__title {
  font-size: clamp(1.28rem, 1.75vw, 2rem);
}

.funnel-stage__range {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.24);
  font-size: clamp(0.9rem, 0.95vw, 1.28rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  opacity: 1;
  white-space: nowrap;
}

.funnel-stage--week3 .funnel-stage__range,
.funnel-stage--next .funnel-stage__range {
  border-color: transparent;
  background: #f7fafb;
  color: #0b2237;
  box-shadow: 0 2px 8px rgba(3, 18, 28, 0.35);
}

.funnel-stage--current .funnel-stage__range {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(8, 32, 42, 0.45);
  color: #fff;
}

.funnel-stage__cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(var(--funnel-rows), var(--funnel-card-h));
  justify-content: stretch;
  align-content: start;
  gap: clamp(8px, 1vh, 12px);
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.funnel-stage[data-columns="2"] .funnel-stage__cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
}

.funnel-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  height: var(--funnel-card-h);
  width: 100%;
  overflow: hidden;
  padding: calc(clamp(10px, 1vh, 14px) * var(--funnel-pad-scale))
    calc(clamp(12px, 0.9vw, 18px) * var(--funnel-pad-scale));
  border: 2px solid #6f808a;
  border-radius: 8px;
  color: #071827;
  background:
    radial-gradient(circle at 7px 7px, #fff 0 1px, #6f808a 1.4px 2.4px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 7px) 7px, #fff 0 1px, #6f808a 1.4px 2.4px, transparent 2.8px),
    radial-gradient(circle at 7px calc(100% - 7px), #fff 0 1px, #6f808a 1.4px 2.4px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), #fff 0 1px, #6f808a 1.4px 2.4px, transparent 2.8px),
    linear-gradient(180deg, #ffffff 0%, #f4f7f8 100%);
  box-shadow: inset 4px 0 0 #0f8c9c, 0 6px 14px rgba(8, 26, 41, 0.16);
}

.funnel-card--delayed {
  border-color: #b56d68;
  background:
    radial-gradient(circle at 7px 7px, #fff 0 1px, #a56b66 1.4px 2.4px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 7px) 7px, #fff 0 1px, #a56b66 1.4px 2.4px, transparent 2.8px),
    radial-gradient(circle at 7px calc(100% - 7px), #fff 0 1px, #a56b66 1.4px 2.4px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), #fff 0 1px, #a56b66 1.4px 2.4px, transparent 2.8px),
    linear-gradient(180deg, #ffffff 0%, #fff7f6 100%);
  box-shadow: inset 5px 0 0 var(--funnel-danger), 0 6px 14px rgba(8, 26, 41, 0.16);
}

.funnel-card__top,
.funnel-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.funnel-card__top {
  align-items: flex-start;
}

.funnel-card__identity {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, calc(var(--funnel-card-h) * 0.022), 6px);
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

/* Project and milestone names wrap to at most two lines; they are never cut
   with an ellipsis, because both carry information the room needs. */
.funnel-card__project {
  min-width: 0;
  max-height: 2.4em;
  overflow: hidden;
  color: #126f86;
  font-size: max(0.92rem, min(calc(var(--funnel-card-h) * 0.115), 1.12rem));
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: break-word;
  text-overflow: clip;
  white-space: normal;
}

.funnel-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
  gap: clamp(3px, calc(var(--funnel-card-h) * 0.022), 6px);
}

.funnel-card__date {
  flex: 0 0 auto;
  min-width: max-content;
  padding: 3px 7px;
  border: 1px solid #c3e0e6;
  border-radius: 7px;
  color: #07566c;
  background: #e7f4f6;
  font-size: max(0.88rem, min(calc(var(--funnel-card-h) * 0.125), 1.14rem));
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Rescheduled milestones read as "was → now": muted previous date, clear
   arrow, strong current date, then the compact delay chip. */
.funnel-card__shift {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  /* Wrapping is the safety valve: an unusually wide row drops the delay chip to
     a second line instead of being clipped by the card. */
  flex: 0 0 auto;
  flex-wrap: wrap;
  column-gap: clamp(3px, 0.34vw, 7px);
  row-gap: 2px;
  min-width: 0;
  white-space: nowrap;
}

.funnel-shift__was {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: #46596b;
  font-size: clamp(0.74rem, calc(var(--funnel-card-h) * 0.1), 0.96rem);
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.funnel-shift__was .funnel-shift__arrow {
  margin-left: clamp(3px, 0.3vw, 6px);
}

.funnel-card__date--now {
  font-size: clamp(0.8rem, calc(var(--funnel-card-h) * 0.108), 1rem);
}

.funnel-shift__label {
  margin-right: 0.34em;
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
}

.funnel-shift__arrow {
  flex: 0 0 auto;
  width: clamp(15px, calc(var(--funnel-card-h) * 0.13), 22px);
  height: auto;
  color: #3f5266;
}

.funnel-card__date--now .funnel-shift__label {
  color: #3d7d90;
}

.funnel-card__name {
  min-width: 0;
  max-height: 2.65em;
  overflow: hidden;
  color: #0a2034;
  font-size: calc(
    max(1.08rem, min(calc(var(--funnel-card-h) * 0.178), 1.72rem)) * var(--funnel-name-scale)
  );
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  text-overflow: clip;
  white-space: normal;
}

.funnel-flow {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: clamp(5px, 0.42vw, 8px);
  min-width: 0;
  overflow: hidden;
  padding: 3px 6px;
  border: 1px solid #cedfe5;
  border-radius: 999px;
  background: #eef5f7;
}

.funnel-flow__owners {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

/* The receiver is the end of the handoff story, so it keeps its full width and
   the owner side absorbs any remaining pressure. */
.funnel-flow__receivers {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
}

.funnel-flow__arrow {
  flex: 0 0 auto;
  width: clamp(16px, calc(var(--funnel-card-h) * 0.16), 24px);
  height: auto;
  color: #b66b12;
}

/* Handoffs with three or more owners tighten the chips instead of letting the
   flow run past the card edge. */
.funnel-flow[data-owners="3"] {
  gap: clamp(4px, 0.34vw, 7px);
}

.funnel-flow[data-owners="3"] .funnel-owner,
.funnel-flow[data-owners="3"] .funnel-receiver {
  padding: 0 clamp(5px, 0.4vw, 8px);
  letter-spacing: 0.02em;
}

.funnel-flow[data-owners="4"] {
  gap: 4px;
}

.funnel-flow[data-owners="4"] .funnel-flow__owners {
  gap: 3px;
}

.funnel-flow[data-owners="4"] .funnel-owner,
.funnel-flow[data-owners="4"] .funnel-receiver {
  padding: 0 clamp(4px, 0.32vw, 6px);
  font-size: clamp(0.56rem, calc(var(--funnel-card-h) * 0.07), 0.72rem);
  letter-spacing: 0.01em;
}

.funnel-flow[data-owners="4"] .funnel-flow__arrow {
  width: clamp(13px, calc(var(--funnel-card-h) * 0.13), 20px);
}

.funnel-owner,
.funnel-receiver,
.funnel-delay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  height: clamp(22px, calc(var(--funnel-card-h) * 0.19), 30px);
  padding: 0 clamp(7px, 0.55vw, 11px);
  border-radius: 7px;
  font-size: max(0.68rem, min(calc(var(--funnel-card-h) * 0.082), 0.86rem));
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.funnel-owner {
  border: 1px solid #c5d3dd;
  color: #304e66;
  background: #fff;
}

/* Team hues mirror TEAM_SQUARE_TONES in the Portfolio view. */
.funnel-owner[data-team="fw"],
.funnel-owner[data-team="sw"] {
  border-color: #60a5fa;
  color: #1e40af;
  background: #bfdbfe;
}

.funnel-owner[data-team="app"] {
  border-color: #a78bfa;
  color: #5b21b6;
  background: #ddd6fe;
}

.funnel-owner[data-team="qa"] {
  border-color: #34d399;
  color: #065f46;
  background: #a7f3d0;
}

.funnel-owner[data-team="be"] {
  border-color: #22d3ee;
  color: #0e7490;
  background: #a5f3fc;
}

.funnel-owner[data-team="csl"],
.funnel-owner[data-team="audio"] {
  border-color: #f472b6;
  color: #9d174d;
  background: #fbcfe8;
}

/* A team keeps one hue in both roles: the owner chip is the pale tint and the
   receiver chip is the saturated shade of the same Portfolio colour, so the
   handoff target still stands out without renaming the colour of the team. */
.funnel-receiver {
  border: 1px solid #05475b;
  color: #fff;
  background: #07566c;
  box-shadow: 0 1px 4px rgba(6, 65, 83, 0.3);
}

.funnel-receiver[data-team="fw"],
.funnel-receiver[data-team="sw"] {
  border-color: #3b82f6;
  color: #12306e;
  background: #60a5fa;
  box-shadow: 0 1px 4px rgba(30, 64, 175, 0.26);
}

.funnel-receiver[data-team="app"] {
  border-color: #8b5cf6;
  color: #3b1580;
  background: #a78bfa;
  box-shadow: 0 1px 4px rgba(91, 33, 182, 0.26);
}

.funnel-receiver[data-team="qa"] {
  border-color: #10b981;
  color: #04503a;
  background: #34d399;
  box-shadow: 0 1px 4px rgba(6, 95, 70, 0.26);
}

.funnel-receiver[data-team="be"] {
  border-color: #06b6d4;
  color: #0b4d61;
  background: #22d3ee;
  box-shadow: 0 1px 4px rgba(14, 116, 144, 0.26);
}

.funnel-receiver[data-team="csl"],
.funnel-receiver[data-team="audio"] {
  border-color: #ec4899;
  color: #76123f;
  background: #f472b6;
  box-shadow: 0 1px 4px rgba(157, 23, 77, 0.26);
}

.funnel-delay {
  flex: 0 0 auto;
  padding: 0 clamp(5px, 0.42vw, 9px);
  border: 1px solid #e5a19d;
  color: #8f2723;
  background: #fde7e5;
  box-shadow: 0 1px 3px rgba(143, 39, 35, 0.12);
  letter-spacing: 0.02em;
}

.funnel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  padding: 16px;
  border: 1px dashed currentColor;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.66;
}

/* Story Trial — 2026 product wallboard; Classic TV remains intact. */
.funnel-tv--story {
  --bg: #e8ecf2;
  --bg-accent: #f6f8fb;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --surface: #ffffff;
  --surface-muted: rgba(255, 255, 255, 0.45);
  --text-primary: #0c1624;
  --text-secondary: #4f5d6d;
  --text-muted: #7a8796;
  --border: rgba(12, 22, 36, 0.07);
  --shadow: 0 24px 48px -32px rgba(12, 22, 36, 0.35);
  --shadow-soft: 0 8px 24px -12px rgba(12, 22, 36, 0.18);
  --shadow-card: 0 16px 40px -24px rgba(12, 22, 36, 0.42);
  --qa: #0d8a98;
  --fw: #d48a1a;
  --app: #6f4fd4;
  --risk: #d63c3c;
  --success: #1e9a62;

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 28px;
  --space-6: 40px;

  --radius-card: 18px;
  --radius-zone: 22px;

  --fs-title: 42px;
  --fs-ship: 34px;
  --fs-section: 30px;
  --fs-card: 24px;
  --fs-deliverable: 19px;
  --fs-date: 18px;
  --fs-meta: 14px;
  --fs-min: 14px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.funnel-tv--story [data-stream="qa"] { --stream: var(--qa); --stream-soft: rgba(15, 138, 153, 0.1); }
.funnel-tv--story [data-stream="fw"] { --stream: var(--fw); --stream-soft: rgba(201, 130, 22, 0.12); }
.funnel-tv--story [data-stream="app"] { --stream: var(--app); --stream-soft: rgba(117, 82, 209, 0.1); }

/* Shell */
.funnel-tv--story .funnel-tv__stage {
  padding: var(--space-4) var(--space-6) var(--space-2);
  color: var(--text-primary);
  background:
    linear-gradient(180deg, rgba(236, 240, 246, 0.94) 0%, rgba(228, 233, 240, 0.92) 100%),
    url("/static/img/cardo-riders-funnel-bg.jpg") center center / cover no-repeat;
}

.funnel-tv--story .funnel-tv__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.funnel-tv--story .funnel-tv__stage::before,
.funnel-tv--story .funnel-rider {
  display: none;
}

.funnel-tv--story .funnel-tv__header {
  min-height: 96px;
  padding: 0;
  align-items: flex-end;
}

.funnel-tv--story .funnel-tv__logo {
  width: 56px;
  height: 56px;
  filter: none;
}

.funnel-tv--story .funnel-tv__kicker {
  color: var(--text-muted);
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: 0.2em;
}

.funnel-tv--story .funnel-tv__title {
  color: var(--text-primary);
  font-size: var(--fs-title);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: none;
}

.funnel-tv--story .funnel-tv__week-context {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
  margin: 6px 0 2px;
}

.funnel-tv--story .funnel-tv__ship-eyebrow {
  color: var(--qa);
  font-size: var(--fs-meta);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.funnel-tv--story .funnel-tv__ship-range {
  color: var(--text-primary);
  font-size: var(--fs-ship);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.funnel-tv--story .funnel-tv__delay-banner {
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--risk);
  background: rgba(214, 60, 60, 0.12);
  font-size: var(--fs-meta);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.funnel-tv--story .funnel-tv__subtitle {
  display: none;
}

.funnel-tv--story .funnel-tv__subtitle-hint {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.funnel-tv--story .funnel-tv__updated,
.funnel-tv--story .funnel-tv__footer {
  color: var(--text-muted);
  font-size: var(--fs-min);
  font-weight: 600;
  text-shadow: none;
}

.funnel-tv--story .funnel-tv__meta {
  opacity: 0.88;
}

.funnel-tv--story .funnel-tv__btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--glass);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.funnel-tv--story .funnel-tv__btn:hover {
  border-color: rgba(15, 28, 43, 0.18);
  background: var(--surface);
}

.funnel-tv--story .funnel-tv__btn--story[aria-pressed="true"] {
  border-color: var(--text-primary);
  color: #fff;
  background: var(--text-primary);
}

/* Board — Inputs → gates → releases, next 2 weeks */
.funnel-tv__board--story {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0;
  min-height: 0;
  margin-top: var(--space-1);
  color: var(--text-primary);
}

.story-main {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 92px minmax(280px, 300px) 92px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 6px;
  row-gap: var(--space-2);
  padding-bottom: var(--space-2);
}

.story-canvas {
  position: relative;
  isolation: isolate;
}

/* Release zones share the main grid rows with QA / APP gates */
.story-main .story-destinations {
  display: contents;
}

.story-main .story-zone--fw {
  grid-column: 5;
  grid-row: 1;
  min-height: 0;
  align-self: stretch;
}

.story-main .story-zone--app-out {
  grid-column: 5;
  grid-row: 2;
  min-height: 0;
  align-self: stretch;
}

.story-main .story-zone--fw.story-zone--idle,
.story-main .story-zone--app-out.story-zone--idle {
  align-self: start;
}

.story-zone--idle .story-zone__cards {
  display: none;
}

.story-zone--idle .story-zone__status {
  display: flex !important;
  margin-top: 2px;
  padding-bottom: 2px;
}

.story-zone__status-note {
  display: none;
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.story-zone--app-out.story-zone--idle .story-zone__status-note {
  display: block;
}

.story-main .story-zone--inputs { grid-column: 1; grid-row: 1 / 3; }
.story-main .story-gate--qa { grid-column: 3; grid-row: 1; align-self: center; }
.story-main .story-gate--app { grid-column: 3; grid-row: 2; align-self: center; }
.story-main .story-link--qa-in { grid-column: 2; grid-row: 1; }
.story-main .story-link--qa-out { grid-column: 4; grid-row: 1; }
.story-main .story-link--app-in { grid-column: 2; grid-row: 2; }
.story-main .story-link--app-out { grid-column: 4; grid-row: 2; }

/* Flow zones — tinted panels: cool Input area vs warm/violet release areas */
.story-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: 18px;
  overflow: hidden;
}

.story-main .story-zone--inputs {
  background: linear-gradient(160deg, rgba(42, 102, 178, 0.13), rgba(15, 138, 153, 0.07));
  box-shadow: inset 0 0 0 1px rgba(42, 102, 178, 0.18);
}

.story-main .story-zone--fw {
  background: linear-gradient(160deg, rgba(201, 130, 22, 0.17), rgba(201, 130, 22, 0.06));
  box-shadow: inset 4px 0 0 var(--fw), inset 0 0 0 1px rgba(201, 130, 22, 0.22);
}

.story-main .story-zone--app-out {
  background: linear-gradient(160deg, rgba(117, 82, 209, 0.16), rgba(117, 82, 209, 0.05));
  box-shadow: inset 4px 0 0 var(--app), inset 0 0 0 1px rgba(117, 82, 209, 0.22);
}

.story-zone__cards--now {
  flex: 1 1 auto;
  align-content: start;
}

.story-zone__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 0 0 auto;
  margin-bottom: var(--space-2);
}

.story-zone__title {
  min-width: 0;
  width: 100%;
}

.story-zone__heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0;
}

.story-zone__heading-text {
  color: var(--text-primary);
  font-size: var(--fs-section);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.story-zone__status {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-clear__mark {
  color: var(--success);
  font-weight: 700;
}

.story-sticker {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.story-sticker--qa {
  color: var(--qa);
  background: rgba(13, 138, 152, 0.12);
}

.story-sticker--fw {
  color: var(--fw);
  background: rgba(212, 138, 26, 0.14);
}

.story-sticker--app {
  color: var(--app);
  background: rgba(111, 79, 212, 0.12);
}

.story-zone__note {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.story-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--text-primary);
  background: rgba(12, 22, 36, 0.06);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.story-zone__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: var(--space-2);
  min-height: 0;
  overflow: hidden;
}

.story-zone--fw .story-zone__cards--now,
.story-zone--app-out .story-zone__cards--now {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Cards */
.story-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  border-radius: var(--radius-card);
  animation: story-enter 520ms var(--ease) both;
}

.story-zone__cards > :nth-child(2) { animation-delay: 50ms; }
.story-zone__cards > :nth-child(3) { animation-delay: 100ms; }
.story-zone__cards > :nth-child(4) { animation-delay: 150ms; }
.story-zone__cards > :nth-child(5) { animation-delay: 200ms; }
.story-zone__cards > :nth-child(6) { animation-delay: 250ms; }

.story-zone__cards--now .story-card {
  padding: var(--space-3);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.story-zone__cards--now .story-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: var(--radius-card) 0 0 var(--radius-card);
  background: linear-gradient(180deg, var(--stream), transparent 120%);
  opacity: 0.85;
}

.story-card--delayed::before {
  background: var(--risk) !important;
}

.story-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px var(--space-2);
  margin-top: 8px;
}

.story-card__date {
  color: var(--text-primary);
  font-size: var(--fs-date);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.story-card__project {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--fs-card);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.story-card__name {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: var(--fs-deliverable);
  font-weight: 800;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.story-card__flow {
  color: var(--text-muted);
  font-size: calc(var(--fs-meta) * 0.9);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.88;
}

.story-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.story-zone--fw .story-card__foot,
.story-zone--app-out .story-card__foot {
  display: none;
}

.story-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--fs-meta);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.story-pill--team {
  color: var(--text-secondary);
  background: rgba(12, 22, 36, 0.06);
}

.story-pill--muted {
  color: var(--text-muted);
  background: rgba(12, 22, 36, 0.05);
  font-size: calc(var(--fs-meta) * 0.92);
  font-weight: 700;
  opacity: 0.9;
}

.story-pill--risk {
  color: var(--risk);
  background: rgba(214, 60, 60, 0.14);
}

.story-pill--delay {
  background: rgba(214, 60, 60, 0.22);
  box-shadow: 0 0 0 1px rgba(214, 60, 60, 0.25);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-card--delayed {
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(214, 60, 60, 0.12);
}

.story-pill--fw-qa {
  color: var(--fw);
  background: rgba(212, 138, 26, 0.16);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-more,
.story-empty {
  display: grid;
  place-items: center;
  min-height: 64px;
  border-radius: var(--radius-card);
  color: var(--text-muted);
  background: var(--surface-muted);
  font-weight: 700;
}

.story-empty--quiet {
  min-height: 0;
  padding: var(--space-5) var(--space-2);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: var(--fs-deliverable);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.story-empty--dest {
  padding: var(--space-2) 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-align: left;
  justify-items: start;
}

.story-spark {
  margin-left: 6px;
  color: var(--fw);
  font-weight: 400;
}

.funnel-tv__board--story[data-density="busy"] .story-zone__cards--now {
  gap: 8px;
}

.funnel-tv__board--story[data-density="busy"] .story-card__project {
  font-size: 21px;
}

.funnel-tv__board--story[data-density="busy"] .story-card__name {
  font-size: 17px;
}

.funnel-tv__board--story[data-density="airy"] .story-card__project {
  font-size: 26px;
}

.funnel-tv__board--story[data-density="airy"] .story-card__name {
  font-size: 20px;
}

.story-more {
  font-size: 20px;
}

.story-empty {
  grid-column: 1 / -1;
  font-size: var(--fs-meta);
}

/* Flow connectors — horizontal links between zones */
.story-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 2px;
  color: var(--stream);
  z-index: 2;
}

.story-link__label {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--stream);
}

.story-connector {
  width: 88px;
  height: auto;
  overflow: visible;
}

.story-connector__track {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  opacity: 0.15;
}

.story-connector__line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.75;
  stroke-linecap: round;
  opacity: 0.55;
}

.story-connector__head {
  fill: currentColor;
  stroke: none;
  opacity: 0.78;
  filter: drop-shadow(0 1px 2px rgba(12, 22, 36, 0.12));
}

.story-connector--qa { color: var(--qa); }
.story-connector--fw { color: var(--fw); }
.story-connector--app { color: var(--app); }

/* QA / APP gate funnels — central routing */
.story-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  padding: 0;
  color: var(--stream);
}

.story-gate__eyebrow {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.story-funnel {
  width: 260px;
  height: auto;
  max-height: 282px;
  filter: drop-shadow(0 10px 20px rgba(12, 22, 36, 0.12));
}

.story-funnel__stop-top {
  stop-color: var(--stream);
  stop-opacity: 0.2;
}

.story-funnel__stop-bottom {
  stop-color: var(--stream);
  stop-opacity: 0.62;
}

.story-funnel__body,
.story-funnel__rim {
  stroke: var(--stream);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.story-funnel__rim {
  fill: var(--surface);
}

.story-funnel__flow {
  fill: none;
  stroke: var(--stream);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.45;
}

.story-funnel__label {
  fill: var(--stream);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

/* Motion — slow, TV-safe */

@keyframes story-flow {
  to { stroke-dashoffset: -48; }
}

@keyframes story-flow-down {
  to { stroke-dashoffset: -18; }
}

@keyframes story-connector-flow {
  0%, 16% { stroke-dashoffset: 0; opacity: 0.38; }
  58% { stroke-dashoffset: -43; opacity: 0.58; }
  72%, 100% { stroke-dashoffset: -43; opacity: 0.38; }
}

@keyframes story-connector-dot {
  0%, 16% { transform: translateX(0); opacity: 0.35; }
  58% { transform: translateX(56px); opacity: 0.95; }
  72%, 100% { transform: translateX(56px); opacity: 0.35; }
}

@keyframes story-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .story-card {
    animation: none;
    transition: none;
  }
}

.funnel-rider {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.funnel-rider__bike {
  position: absolute;
  left: -20%;
  top: 70%;
  width: clamp(86px, 7.2vw, 124px);
  height: auto;
  opacity: 0;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.5));
}

@media (prefers-reduced-motion: reduce) {
  .funnel-rider {
    display: none;
  }
}

.funnel-tv__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  min-height: 30px;
  padding: 7px 10px 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(0.66rem, 0.68vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Dense cards keep all milestones visible without collapsing the list. */
.funnel-tv--dense .funnel-stage__cards {
  gap: 6px;
}

.funnel-tv--dense .funnel-card {
  padding: calc(6px * var(--funnel-pad-scale)) calc(9px * var(--funnel-pad-scale));
}

.funnel-tv--dense .funnel-card__name {
  font-size: calc(max(0.98rem, min(calc(var(--funnel-card-h) * 0.17), 1.32rem)) * var(--funnel-name-scale));
}

.funnel-tv--dense .funnel-card__project {
  font-size: max(0.84rem, min(calc(var(--funnel-card-h) * 0.108), 1rem));
}

.funnel-tv--dense .funnel-card__date {
  padding: 2px 6px;
  font-size: clamp(0.66rem, calc(var(--funnel-card-h) * 0.105), 0.86rem);
}

/* Tight cards drop the "was / now" words; the arrow still carries the meaning. */
.funnel-tv--dense .funnel-shift__label {
  display: none;
}

.funnel-tv--dense .funnel-shift__was {
  font-size: clamp(0.62rem, calc(var(--funnel-card-h) * 0.1), 0.84rem);
}

.funnel-tv--dense .funnel-flow {
  padding: 2px 5px;
}

.funnel-tv--dense .funnel-owner,
.funnel-tv--dense .funnel-receiver,
.funnel-tv--dense .funnel-delay {
  height: clamp(17px, calc(var(--funnel-card-h) * 0.22), 24px);
  padding: 0 5px;
  font-size: clamp(0.54rem, calc(var(--funnel-card-h) * 0.09), 0.7rem);
}

/* Two tight lines: identity + date, then the complete handoff. */
.funnel-tv--compact .funnel-stage__cards {
  gap: 4px;
}

.funnel-tv--compact .funnel-card {
  padding: calc(4px * var(--funnel-pad-scale)) calc(7px * var(--funnel-pad-scale));
}

.funnel-tv--compact .funnel-card__identity {
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
}

.funnel-tv--compact .funnel-card__name {
  order: -1;
  flex: 0 1 auto;
  font-size: calc(max(0.92rem, min(calc(var(--funnel-card-h) * 0.19), 1.12rem)) * var(--funnel-name-scale));
}

.funnel-tv--compact .funnel-card__project {
  flex: 1 1 auto;
  font-size: clamp(0.56rem, calc(var(--funnel-card-h) * 0.115), 0.72rem);
}

.funnel-tv--compact .funnel-card__date {
  padding: 2px 5px;
  font-size: clamp(0.61rem, calc(var(--funnel-card-h) * 0.12), 0.76rem);
}

.funnel-tv--compact .funnel-card__shift {
  gap: 4px;
}

.funnel-tv--compact .funnel-shift__was {
  font-size: clamp(0.58rem, calc(var(--funnel-card-h) * 0.115), 0.74rem);
}

.funnel-tv--compact .funnel-shift__arrow {
  width: clamp(12px, calc(var(--funnel-card-h) * 0.14), 17px);
}

.funnel-tv--compact .funnel-flow {
  padding: 1px 4px;
  gap: 4px;
}

.funnel-tv--compact .funnel-owner,
.funnel-tv--compact .funnel-receiver,
.funnel-tv--compact .funnel-delay {
  height: clamp(15px, calc(var(--funnel-card-h) * 0.23), 20px);
  padding: 0 4px;
  font-size: clamp(0.48rem, calc(var(--funnel-card-h) * 0.095), 0.62rem);
}

.funnel-tv--compact .funnel-flow__arrow {
  width: clamp(11px, calc(var(--funnel-card-h) * 0.14), 16px);
}

/* Last-resort scale tier for unusually busy weeks. It still keeps project,
   milestone, date, owners, receiver and delay visible. */
.funnel-tv--packed .funnel-stage__cards {
  gap: 2px;
}

.funnel-tv--packed .funnel-card {
  padding: calc(2px * var(--funnel-pad-scale)) calc(5px * var(--funnel-pad-scale));
  border-radius: 8px;
}

.funnel-tv--packed .funnel-card__top,
.funnel-tv--packed .funnel-card__bottom {
  gap: 4px;
}

.funnel-tv--packed .funnel-card__identity {
  gap: 4px;
}

/* Vertical room is scarcest here, so the date and delay share one line. */
.funnel-tv--packed .funnel-card__meta {
  flex-direction: row;
  align-items: center;
  gap: 3px;
}

.funnel-tv--packed .funnel-card__name {
  font-size: calc(clamp(0.58rem, calc(var(--funnel-card-h) * 0.22), 0.76rem) * var(--funnel-name-scale));
}

.funnel-tv--packed .funnel-card__project {
  font-size: clamp(0.48rem, calc(var(--funnel-card-h) * 0.14), 0.62rem);
}

.funnel-tv--packed .funnel-card__date {
  padding: 1px 4px;
  border-radius: 5px;
  font-size: clamp(0.5rem, calc(var(--funnel-card-h) * 0.145), 0.65rem);
}

.funnel-tv--packed .funnel-card__shift {
  gap: 3px;
}

.funnel-tv--packed .funnel-shift__was {
  font-size: clamp(0.5rem, calc(var(--funnel-card-h) * 0.14), 0.64rem);
}

.funnel-tv--packed .funnel-shift__arrow {
  width: clamp(10px, calc(var(--funnel-card-h) * 0.15), 14px);
}

.funnel-tv--packed .funnel-flow {
  padding: 0 3px;
  border-radius: 6px;
}

.funnel-tv--packed .funnel-owner,
.funnel-tv--packed .funnel-receiver,
.funnel-tv--packed .funnel-delay {
  height: clamp(12px, calc(var(--funnel-card-h) * 0.3), 16px);
  padding: 0 3px;
  border-radius: 4px;
  font-size: clamp(0.42rem, calc(var(--funnel-card-h) * 0.12), 0.52rem);
}

.funnel-tv:fullscreen,
.funnel-tv:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

@media (max-width: 1400px) {
  .funnel-tv {
    padding-left: 18px;
    padding-right: 18px;
  }

  .funnel-tv__board {
    grid-template-columns: minmax(400px, 1.2fr) minmax(240px, 0.86fr) minmax(200px, 0.58fr);
  }

  .funnel-stage {
    padding-left: 16px;
    padding-right: 18px;
  }

  .funnel-stage--next {
    margin-left: -20px;
    padding-left: 32px;
  }

  .funnel-stage--week3 {
    margin-left: -20px;
    padding-left: 26px;
  }

  .funnel-stage--current {
    padding-right: 24px;
  }
}
