/* Funnel editor and follow-up flow; loaded after the shared brand styles. */
.funnel-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 17px;
}
.funnel-tabs > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 35px;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid #d6dce0;
  border-radius: 3px;
  background: #fff;
  color: #56616c;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.funnel-tabs > button:hover { border-color: #a4be86; background: #f8fbf4; }
.funnel-tabs > button.active { color: #345d00; border-color: #a9ca82; background: #edf5e4; box-shadow: inset 0 -2px 0 #71be00; }
.funnel-tabs > button > span { min-width: 20px; padding: 1px 5px; border-radius: 3px; background: #edf0f2; color: #68737c; font-size: 10px; font-weight: 400; }
.funnel-tabs > button.active > span { background: #dcebc8; color: #3e5c24; }

.kanban-editing-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin: 0 0 18px;
  padding: 13px 16px;
  background: #f1f7e9;
  border: 1px solid #cbdcb7;
  border-left: 3px solid #71be00;
  border-radius: 3px;
  color: #485d34;
  font-size: 12px;
  line-height: 1.6;
}
.kanban-editing-banner > div { min-width: 0; }
.kanban-editing-banner strong { color: #354828; }
.kanban-editing-banner p { margin: 3px 0 0; }
.kanban-editing-banner .button-row { flex-wrap: wrap; }

.funnel-editor { min-width: 0; }
.funnel-editor-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.funnel-editor-heading > div { min-width: 0; }
.funnel-editor-heading h2 { color: #424b54; font-size: 16px; }
.funnel-editor-heading p { margin: 5px 0 0; color: #69737d; font-size: 11px; }
.funnel-editor-heading .button-row { flex-wrap: wrap; }
.funnel-map { position: relative; min-width: 0; padding: 0 16px; border: 1px solid #dfe3e5; border-radius: 4px; background: #fff; isolation: isolate; }
.funnel-map-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: start; gap: 18px; min-width: 0; padding: 24px 0 32px; }
.funnel-map-row + .funnel-map-row { border-top: 1px solid #e8ece5; }
.funnel-map-label { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 5px 8px 5px 0; background: #fff; }
.funnel-map-label strong { color: #424b54; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.funnel-map-label small { color: #7b8571; font-size: 10px; }
.funnel-map-label .link-button, .funnel-map-label .text-button { padding: 0; text-align: left; font-size: 10px; }
.funnel-map-stages { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 8px; min-width: 0; }
.funnel-stage-node { position: relative; display: flex; flex: 1 1 120px; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; }
.funnel-stage-chip { position: relative; z-index: 3; display: flex; align-items: center; justify-content: flex-start; gap: 5px; width: 100%; min-width: 0; min-height: 34px; padding: 7px 18px 7px 12px; border: 0; border-radius: 0; background: var(--stage-color, #c3e0a0); color: var(--stage-ink, #293522); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 6px 50%); font-size: 11px; font-weight: 600; line-height: 1.5; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-stage-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-stage-chip:hover { filter: brightness(.96); }
.funnel-stage-chip:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #353e48; }
.tunnel-port { position: relative; z-index: 4; display: grid; place-items: center; width: 28px; height: 28px; min-width: 28px; margin: -4px 0 0; padding: 0; border: 0; border-radius: 50%; color: #718160; background: transparent; font-size: 0; }
.tunnel-port::before { content: ""; display: block; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: #d3ddc7; box-shadow: 0 0 0 1px #a8b895; }
.tunnel-port:hover::before, .tunnel-port.is-target::before { background: #71be00; box-shadow: 0 0 0 2px #badb92; }
.tunnel-port.is-selected::before, .funnel-stage-node.is-selected .tunnel-port::before { background: #477900; box-shadow: 0 0 0 3px #d9edc2; }
.tunnel-port.is-selected, .tunnel-port.is-target { background: #f0f7e6; }
.tunnel-port:focus-visible { outline: 2px solid #477900; outline-offset: 1px; }
.funnel-links-svg { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.funnel-links-svg path { fill: none; stroke: #71be00; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.funnel-links-svg marker path { fill: #71be00; stroke: none; }
.funnel-links-svg text { fill: #477900; font-family: inherit; font-size: 10px; }

.funnel-editor-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-width: 0; margin-top: 16px; }
.funnel-editor-panel { min-width: 0; padding: 17px 18px; border: 1px solid #dfe3e5; border-radius: 4px; background: #fff; }
.funnel-editor-panel > h3 { margin-bottom: 12px; color: #424b54; font-size: 13px; }
.funnel-editor-panel > p { margin: 8px 0 0; color: #69737d; font-size: 11px; }
.funnel-editor-panel .button-row { flex-wrap: wrap; }
.funnel-route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; padding: 11px 0; border-bottom: 1px solid #e8ece5; color: #556249; font-size: 11px; line-height: 1.55; }
.funnel-route:first-of-type { padding-top: 0; }
.funnel-route:last-child { border-bottom: 0; padding-bottom: 0; }
.funnel-route > span:not(.route-mode) { min-width: 0; overflow-wrap: anywhere; }
.funnel-route strong { color: #424b54; font-size: 11px; }
.funnel-route .route-mode { display: inline-flex; align-items: center; max-width: 100%; padding: 3px 6px; border: 1px solid #d9e6ca; border-radius: 3px; background: #f1f6eb; color: #526b3b; font-size: 10px; overflow-wrap: anywhere; }
.funnel-route .route-remove { margin-left: auto; flex-shrink: 0; color: #9a6969; }
.funnel-route .route-remove:hover { color: #a33d3d; background: #fcf0f0; }
.funnel-editor-hint { margin: 12px 0 0; padding: 10px 12px; border-left: 2px solid #bbd59b; background: #f6f9f2; color: #697760; font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.tunnel-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; min-width: 0; }
.tunnel-form > h3, .tunnel-form > p, .tunnel-form > .notice, .tunnel-form > .button-row, .tunnel-form > .full-width, .tunnel-form > .help { grid-column: 1 / -1; }
.tunnel-form .field, .tunnel-form .field select, .tunnel-form .field input { min-width: 0; max-width: 100%; }
.tunnel-form > .button-row { justify-content: flex-end; flex-wrap: wrap; margin-top: 3px; }

.followup-context { padding: 12px 14px; margin: 0 0 17px; border: 1px solid #d8e4ca; border-left: 3px solid #71be00; border-radius: 3px; background: #f4f8ee; color: #5a6d49; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.followup-context strong { color: #424b54; }
.followup-context p { margin: 5px 0 0; }
.followup-details { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 18px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid #cbdcb7; border-left: 3px solid #71be00; border-radius: 3px; background: #f4f8ee; color: #58684a; }
.followup-details > div { min-width: 0; }
.followup-details strong { color: #424b54; font-size: 12px; }
.followup-details p { margin: 5px 0 0; font-size: 11px; overflow-wrap: anywhere; }
.followup-details .button-row { flex-wrap: wrap; }
.followup-contact-summary { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; color: #637256; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.followup-contact-summary strong { color: #465c35; font-size: inherit; }
#followup-dialog, #tunnel-dialog, #funnel-name-dialog { max-width: none; max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid #d7dce0; border-radius: 4px; box-shadow: 0 18px 50px rgb(35 42 49 / 20%); }
#followup-dialog { width: min(700px, calc(100vw - 32px)); }
#tunnel-dialog { width: min(640px, calc(100vw - 32px)); }
#funnel-name-dialog { width: min(480px, calc(100vw - 32px)); }
#followup-dialog .card-heading, #tunnel-dialog .card-heading, #funnel-name-dialog .card-heading { align-items: flex-start; padding: 17px 20px; }
#followup-dialog .card-body, #tunnel-dialog .card-body, #funnel-name-dialog .card-body { padding: 18px 20px 20px; }
#followup-dialog .button-row, #tunnel-dialog .button-row, #funnel-name-dialog .button-row { flex-wrap: wrap; }

@media (max-width: 1050px) {
  .funnel-map { padding: 0 12px; }
  .funnel-map-row { grid-template-columns: 125px minmax(0, 1fr); gap: 12px; }
  .funnel-stage-node { flex-basis: 115px; }
}
@media (max-width: 760px) {
  .funnel-editor-panels { grid-template-columns: minmax(0, 1fr); }
  .funnel-map-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 18px 0 24px; }
  .funnel-map-label { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 0; }
  .funnel-map-label strong { flex: 1 1 auto; }
  .funnel-map-stages { gap: 8px; }
  .funnel-stage-node { flex-basis: 130px; }
  .funnel-editor-panel { padding: 14px; }
}
@media (max-width: 480px) {
  .funnel-tabs > button { flex: 1 1 135px; padding-inline: 9px; }
  .kanban-editing-banner, .followup-details { padding: 11px 12px; }
  .funnel-map { padding: 0 10px; }
  .funnel-stage-node { flex-basis: 110px; }
  .tunnel-form { grid-template-columns: minmax(0, 1fr); }
  #followup-dialog .card-heading, #tunnel-dialog .card-heading, #funnel-name-dialog .card-heading,
  #followup-dialog .card-body, #tunnel-dialog .card-body, #funnel-name-dialog .card-body { padding: 14px; }
}
