/* An arrow marks a column or a step in a sequence. A record shows a compact status. */
:root :is(#app,#modal-root) .stage-arrow:not(.sales-stage-head:has(.sales-stage-editor)) {
  --stage-arrow-tip: 14px;
  --stage-arrow-outline: var(--stage-arrow-ink,#000);
  position: var(--stage-arrow-position,relative);
  isolation: isolate;
  display: inline-flex;
  min-height: var(--stage-arrow-height,38px);
  height: auto;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  padding: 5px calc(var(--stage-arrow-tip) + 9px) 5px 13px;
  border: 0;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: transparent;
  color: var(--stage-arrow-ink,#000);
  box-shadow: none;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
  text-align: start;
  transform: none;
}

.stage-arrow:not(.sales-stage-head:has(.sales-stage-editor))::before,
button.stage-arrow:is(.is-current,:focus-visible)::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  clip-path: polygon(0 0,calc(100% - var(--stage-arrow-tip)) 0,100% 50%,calc(100% - var(--stage-arrow-tip)) 100%,0 100%);
  content: '';
  pointer-events: none;
}
.stage-arrow:not(.sales-stage-head:has(.sales-stage-editor))::before {
  background: var(--stage-arrow-fill,#c6d4ff);
}
button.stage-arrow:is(.is-current,:focus-visible)::before {
  background: var(--stage-arrow-outline);
}
button.stage-arrow:is(.is-current,:focus-visible)::after {
  --stage-arrow-tip: 12.5px;
  inset: 2px 2.5px 2px 2px;
  background: var(--stage-arrow-fill,#c6d4ff);
  border-radius: var(--r-xs) 0 0 var(--r-xs);
}
:root :is(#app,#modal-root) button.stage-arrow:focus-visible {
  --stage-arrow-outline: var(--accent);
  outline: none;
}
:root :is(#app,#modal-root) button.stage-arrow:enabled { cursor: pointer; }
:root #modal-root button.dc-stage-button:disabled { opacity: 1; cursor: default; }
.stage-arrow.dc-stage-button { flex: 0 0 calc(var(--deal-stage-width) - 2px); }
:root #app :is(.task-stage-title,.sales-stage-head).stage-arrow { justify-content: space-between; }
.stage-arrow.task-stage-title { --stage-arrow-position: sticky; }
.stage-arrow-preview { grid-column: 1/-1; min-width: 0; }
.stage-arrow-preview>span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* One-line status labels, with a separate visual treatment for editable controls. */
:root {
  --workflow-status-tint: 21%;
  --workflow-status-dot-base: #121b2a;
  --workflow-status-dot-tint: 43%;
}
:root[data-theme=dark] {
  --workflow-status-tint: 15%;
  --workflow-status-dot-base: #e9eff8;
  --workflow-status-dot-tint: 47%;
}
:root :is(#app,#modal-root,.filter-select-popup) :is(.workflow-status,.workflow-status-select>.filter-select-trigger,.workflow-status-option) {
  --workflow-fill: var(--stage-arrow-fill,#c6d4ff);
  --workflow-tint: color-mix(in srgb,var(--workflow-fill) var(--workflow-status-tint),var(--surface));
  --workflow-dot: color-mix(in srgb,var(--workflow-fill) var(--workflow-status-dot-tint),var(--workflow-status-dot-base));
}
:root :is(#app,#modal-root) .workflow-status,
:root :is(#app,#modal-root) .workflow-status-select>.filter-select-trigger {
  box-sizing: border-box;
  display: inline-flex;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 25px;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--workflow-tint);
  color: var(--ink);
  box-shadow: none;
  font: inherit;
  font-size: var(--fs-xs);
  line-height: 1.35;
  font-weight: 600;
  text-align: start;
  vertical-align: middle;
  white-space: nowrap;
  overflow-wrap: normal;
  transform: none;
}
:root :is(#app,#modal-root) .workflow-status {
  flex: 0 1 auto;
}
.workflow-status-label,
:root :is(#app,#modal-root) .workflow-status-select .filter-select-value {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.workflow-status::before,
.workflow-status-select>.filter-select-trigger::before,
.workflow-status-option .filter-select-badge.is-status {
  content: '';
  width: 7px;
  height: 7px;
  margin: 0;
  flex: none;
  border-radius: 50%;
  background: var(--workflow-dot);
}
:root :is(#app,#modal-root) :is(button.workflow-status,.workflow-status-select>.filter-select-trigger) {
  min-height: 32px;
  border-color: color-mix(in srgb,var(--workflow-dot) 26%,var(--line));
}
:root :is(#app,#modal-root) :is(button.workflow-status,.workflow-status-select>.filter-select-trigger):hover:not(:disabled) {
  border-color: var(--workflow-dot);
  background: color-mix(in srgb,var(--workflow-dot) 9%,var(--workflow-tint));
}
:root :is(#app,#modal-root) :is(button.workflow-status,.workflow-status-select>.filter-select-trigger):focus-visible {
  outline: 2px solid var(--field-focus,var(--accent));
  outline-offset: 2px;
}
:root :is(#app,#modal-root) .workflow-status-select>.filter-select-trigger[aria-expanded=true] {
  border-color: var(--field-focus,var(--accent));
}
:root :is(#app,#modal-root) :is(.workflow-status-chevron,.workflow-status-select .filter-select-arrow) {
  width: 6px;
  height: 6px;
  flex: none;
  margin-inline-start: 2px;
  margin-inline-end: 2px;
  opacity: .72;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
}
:root :is(#app,#modal-root) .workflow-status-select>.filter-select-trigger[aria-expanded=true] .filter-select-arrow {
  transform: translateY(2px) rotate(225deg);
}
.workflow-status-option .filter-select-label { overflow-wrap: break-word; }
.workflow-status-select { min-width: 0; }
.task-card-actions>.workflow-status-select { flex: 1; min-width: 0; }

.stage-related-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-top: 5px; }
.stage-related-meta :is(.workflow-status,small) { margin: 0; }

@media (max-width: 760px) {
  .dc-stage-button { --stage-arrow-height: 44px; }
  :root :is(#app,#modal-root) :is(button.workflow-status,.workflow-status-select>.filter-select-trigger) {
    min-height: 44px;
  }
}

/* Long built-in statuses still fit next to the assignee on a narrow phone. */
@media (max-width: 390px) {
  :root :is(.project-selectable,.project-task-list) table.mobile-record-table>tbody>tr {
    grid-template-columns: minmax(142px,1fr) minmax(0,1fr);
  }
  :root .task-plan-list table.mobile-record-table>tbody>tr>td:nth-child(2) {
    grid-column: 1/-1;
  }
}
