.codex-panel__region--goal:not(:empty) {
  padding-bottom: var(--codex-panel-edge-padding-x);
}

.codex-panel__goal {
  margin: var(--codex-panel-edge-padding-x) var(--codex-panel-edge-padding-x) 0;
  padding-left: var(--codex-panel-rail-indent);
  border-left: var(--codex-panel-rail);
  color: var(--codex-panel-text-normal);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

.codex-panel__goal--active {
  border-left-color: var(--codex-panel-color-accent);
}

.codex-panel__goal--paused {
  border-left-color: var(--codex-panel-color-warning);
}

.codex-panel__goal--complete {
  border-left-color: var(--codex-panel-color-success);
}

.codex-panel__goal--blocked,
.codex-panel__goal--usageLimited,
.codex-panel__goal--budgetLimited {
  border-left-color: var(--codex-panel-color-danger);
}

.codex-panel__goal-main {
  min-width: 0;
}

.codex-panel__goal-role {
  display: flex;
  align-items: center;
  gap: var(--codex-panel-item-gap);
  margin-bottom: var(--codex-panel-control-gap);
  color: var(--codex-panel-role-label-color);
  font-size: var(--codex-panel-role-label-size);
  font-weight: var(--codex-panel-role-label-weight);
}

.codex-panel__goal-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--codex-panel-control-gap);
}

.codex-panel__goal:hover .codex-panel__goal-action,
.codex-panel__goal-action:focus-visible {
  opacity: 1;
}

.codex-panel__goal-objective-collapse {
  position: relative;
}

.codex-panel__goal-objective {
  position: relative;
  overflow: hidden;
  font-family: var(--codex-panel-content-font);
  font-size: var(--codex-panel-content-font-size);
  overflow-wrap: anywhere;
  cursor: text;
  user-select: text;
  white-space: pre-wrap;
}

.codex-panel__goal-objective--collapsed {
  max-height: var(--codex-panel-size-goal-objective-collapse-max-height);
}

.codex-panel__goal-objective--collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--codex-panel-size-stream-item-collapse-fade-height);
  background: linear-gradient(to bottom, transparent, var(--codex-panel-surface));
  pointer-events: none;
}

.codex-panel__goal-objective-collapse-details {
  position: relative;
  z-index: 1;
  margin-top: var(--codex-panel-item-gap);
}

.codex-panel__goal-objective-collapse-details > summary {
  cursor: default;
  color: var(--text-muted);
  font-size: var(--font-ui-smaller);
}

.codex-panel__goal-objective-collapse-details > summary:hover {
  color: var(--nav-item-color-hover, var(--text-normal));
}

.codex-panel__goal-usage {
  margin-top: var(--codex-panel-control-gap);
  color: var(--codex-panel-text-faint);
  font-size: var(--font-ui-smaller);
  line-height: var(--line-height-tight);
}

.codex-panel__goal-editor {
  display: grid;
  gap: var(--codex-panel-section-gap);
}

.codex-panel__goal-editor-frame {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.codex-panel__goal-objective-input {
  min-height: var(--codex-panel-composer-min-height);
  max-height: min(var(--codex-panel-size-goal-objective-input-max-height), 30vh);
  overflow-y: hidden;
  resize: none;
}

.codex-panel__goal-save {
  min-width: calc(var(--codex-panel-control-icon-size) + var(--codex-panel-panel-gap) * 2);
  margin: var(--codex-panel-panel-gap);
  padding: var(--codex-panel-panel-gap);
}
