.tasks-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.tasks-page .page-head {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tasks-list-page .page-controls.tasks-scope-bar {
  margin-bottom: 8px;
}

.tasks-list-page .tasks-filters {
  margin-bottom: 12px;
}

.tasks-list-page .tasks-list-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
  min-height: 0;
}

.tasks-page .page-head-text {
  flex: 1;
  min-width: 0;
}

.tasks-page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.tasks-page .list-scroll {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  min-height: 12rem;
}

.tasks-page .col-reference {
  max-width: 8rem;
}

.tasks-page .col-assignees {
  max-width: 8.5rem;
  white-space: nowrap;
}

.assignee-stack-popover {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  vertical-align: middle;
}

.assignee-stack__trigger {
  display: inline-flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  border-radius: 999px;
  outline: none;
}

.assignee-stack__trigger::-webkit-details-marker {
  display: none;
}

.assignee-stack__trigger::marker {
  content: "";
}

.assignee-stack__trigger:hover .assignee-stack__strip,
.assignee-stack-popover[open] .assignee-stack__strip {
  opacity: 1;
}

.assignee-stack__strip {
  display: inline-flex;
  align-items: center;
  opacity: 0.96;
}

.assignee-stack {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  vertical-align: middle;
}

.assignee-stack__avatar,
.assignee-stack__overflow {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  box-sizing: border-box;
  flex-shrink: 0;
  margin-inline-start: -8px;
  box-shadow: 0 0 0 2px var(--panel, #fff);
}

.assignee-stack__avatar:first-child,
.assignee-stack__overflow:first-child {
  margin-inline-start: 0;
}

.assignee-stack--sm.assignee-stack__avatar,
.assignee-stack--sm.assignee-stack__overflow,
.assignee-stack--sm .assignee-stack__avatar,
.assignee-stack--sm .assignee-stack__overflow {
  width: 28px;
  height: 28px;
}

.assignee-stack--md.assignee-stack__avatar,
.assignee-stack--md.assignee-stack__overflow,
.assignee-stack--md .assignee-stack__avatar,
.assignee-stack--md .assignee-stack__overflow {
  width: 32px;
  height: 32px;
}

.assignee-stack--panel.assignee-stack__avatar,
.assignee-stack--panel .assignee-stack__avatar {
  width: 30px;
  height: 30px;
  margin-inline-start: 0;
}

.assignee-stack__initials {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  text-rendering: geometricPrecision;
}

.assignee-stack--sm .assignee-stack__initials {
  font-size: 10px;
}

.assignee-stack--panel .assignee-stack__initials {
  font-size: 11px;
}

.assignee-stack__avatar {
  background: hsl(var(--assignee-hue, 210) 52% 84%);
  color: hsl(var(--assignee-hue, 210) 42% 24%);
}

.assignee-stack__overflow {
  background: var(--panel-soft, #f4f2ec);
  color: var(--text, #1f2937);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  z-index: 0;
}

.assignee-stack--empty .assignee-stack__empty {
  color: var(--muted, #6b7280);
  font-size: 12px;
  font-weight: 500;
}

.assignee-stack-popover__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  min-width: 240px;
  max-width: 300px;
  max-height: min(320px, 50vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border-strong, #d8d4cb);
  border-radius: 10px;
  background: var(--panel, #fff);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.assignee-stack-popover__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
}

.assignee-stack-popover__row:hover {
  background: var(--panel-soft, #f4f2ec);
}

.assignee-stack-popover__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.assignee-stack-popover__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text, #1f2937);
}

.assignee-stack-popover__email {
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.policy-detail-view .pack-detail-task-meta .assignee-stack-popover {
  flex-shrink: 0;
}

.tasks-ref-link,
.tasks-ref-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.tasks-ref-link {
  color: var(--accent, #2563eb);
  text-decoration: none;
}

.tasks-ref-link:hover {
  text-decoration: underline;
}

.tasks-page .list-empty {
  margin: 2rem 1rem;
}

:root {
  --task-work-open-bg: #dbeafe;
  --task-work-open-fg: #1d4ed8;
  --task-work-open-ring: #93c5fd;
  --task-work-in-progress-bg: #ccfbf1;
  --task-work-in-progress-fg: #0f766e;
  --task-work-in-progress-ring: #5eead4;
  --task-work-in-review-bg: #ede9fe;
  --task-work-in-review-fg: #6d28d9;
  --task-work-in-review-ring: #c4b5fd;
  --task-work-closed-bg: #f1f5f9;
  --task-work-closed-fg: #475569;
  --task-work-closed-ring: #cbd5e1;
}

.task-work-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 10px;
  white-space: nowrap;
}

.task-work-badge--open {
  background: var(--task-work-open-bg);
  color: var(--task-work-open-fg);
}

.task-work-badge--in_progress {
  background: var(--task-work-in-progress-bg);
  color: var(--task-work-in-progress-fg);
}

.task-work-badge--in_review {
  background: var(--task-work-in-review-bg);
  color: var(--task-work-in-review-fg);
}

.task-work-badge--closed {
  background: var(--task-work-closed-bg);
  color: var(--task-work-closed-fg);
}

.tasks-page .col-work-status {
  width: 118px;
}

.tasks-row {
  cursor: pointer;
}

.task-jira-import-row {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.task-jira-import-row input {
  flex: 1;
  min-width: 0;
}

.tasks-jira-preview {
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
}

.tasks-jira-preview__key {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin: 0 0 0.35rem;
}

.tasks-jira-preview__summary {
  margin: 0 0 0.35rem;
}

.tasks-jira-preview__meta {
  font-size: 0.88rem;
  margin: 0.35rem 0 0;
}

.tasks-jira-preview__desc {
  color: var(--muted, #64748b);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0.65rem 0 0;
  white-space: pre-wrap;
}

.task-work-line {
  align-items: baseline;
  color: var(--muted, #64748b);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.88rem;
  font-weight: 500;
  gap: 0.35rem 0.5rem;
  line-height: 1.4;
  margin: 0 0 0.5rem;
}

.task-work-sep {
  color: var(--border, #cbd5e1);
  user-select: none;
}

.task-work-value {
  color: var(--text, #0f172a);
}

.task-status-note-input {
  min-height: 84px;
  resize: vertical;
  width: 100%;
}

.task-status-timeline {
  list-style: none;
  margin: 0;
  max-height: min(60vh, 420px);
  overflow: auto;
  padding: 4px 0 0 22px;
  position: relative;
}

.task-status-timeline::before {
  background: linear-gradient(
    180deg,
    var(--task-work-open-ring) 0%,
    var(--task-work-in-progress-ring) 35%,
    var(--task-work-in-review-ring) 70%,
    var(--task-work-closed-ring) 100%
  );
  border-radius: 999px;
  bottom: 10px;
  content: "";
  left: 7px;
  position: absolute;
  top: 10px;
  width: 2px;
}

.task-status-timeline-item {
  display: flex;
  gap: 14px;
  padding: 0 0 22px;
  position: relative;
}

.task-status-timeline-item:last-child {
  padding-bottom: 0;
}

.task-status-timeline-marker {
  background: #fff;
  border: 2px solid #93c5fd;
  border-radius: 50%;
  flex: 0 0 auto;
  height: 12px;
  margin-left: -22px;
  margin-top: 8px;
  position: relative;
  width: 12px;
  z-index: 1;
}

.task-status-timeline-item--open .task-status-timeline-marker {
  border-color: var(--task-work-open-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--task-work-open-fg) 18%, transparent);
}

.task-status-timeline-item--in_progress .task-status-timeline-marker {
  border-color: var(--task-work-in-progress-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--task-work-in-progress-fg) 18%, transparent);
}

.task-status-timeline-item--in_review .task-status-timeline-marker {
  border-color: var(--task-work-in-review-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--task-work-in-review-fg) 18%, transparent);
}

.task-status-timeline-item--closed .task-status-timeline-marker {
  border-color: var(--task-work-closed-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--task-work-closed-fg) 18%, transparent);
}

.task-status-timeline-content {
  flex: 1;
  min-width: 0;
}

.task-status-timeline-flow {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-status-timeline-created {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.task-status-timeline-connector {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  min-width: 36px;
}

.task-status-timeline-line {
  background: linear-gradient(
    90deg,
    var(--task-work-in-progress-ring),
    var(--task-work-in-review-ring)
  );
  border-radius: 999px;
  display: block;
  flex: 1;
  height: 2px;
  min-width: 18px;
}

.task-status-timeline-arrow {
  color: var(--task-work-in-review-fg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.task-status-timeline-date {
  color: var(--muted, #64748b);
  display: block;
  font-size: 12px;
  margin-top: 8px;
}

.task-status-timeline-meta {
  color: var(--muted, #64748b);
  font-size: 12px;
  margin-top: 2px;
}

.task-status-timeline-note {
  background: var(--task-work-closed-bg);
  border-left: 3px solid var(--task-work-in-review-ring);
  border-radius: 0 8px 8px 0;
  color: var(--text, #0f172a);
  font-size: 13px;
  line-height: 1.45;
  margin: 8px 0 0;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.task-status-history-empty {
  margin: 0;
}

@media (max-width: 720px) {
  .task-jira-import-row {
    align-items: stretch;
    flex-direction: column;
  }
}
