.composer-wrap {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 0 24px 14px;
}

.composer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(var(--content-width), 100%);
  margin: 0 auto;
  padding: 8px 10px 8px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 140ms ease;
}

.composer:focus-within { border-color: var(--border-focus); }

.composer__input {
  flex: 1;
  min-width: 0;
  max-height: 200px;
  padding: 7px 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  resize: none;
}

.composer__input::placeholder { color: var(--text-faint); }

.composer__actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  max-width: 260px;
  transition: background 120ms ease, color 120ms ease;
}

.model-btn:hover { background: var(--bg-hover-strong); color: var(--text); }
.model-btn__caret { color: var(--text-faint); font-size: 10px; }

.model-btn span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 700;
  transition: opacity 120ms ease, transform 120ms ease;
}

.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.send-btn.is-stopping { background: var(--text-muted); }


/* Composer tools -------------------------------------------------------- */

.composer__tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-faint);
  transition: background 120ms ease, color 120ms ease;
}

.composer__tool:hover { background: var(--bg-hover-solid); color: var(--text); }

/* Recording is a state the user must be able to see at a glance. */
.composer__tool.is-listening {
  background: hsl(5 65% 52% / 0.18);
  color: hsl(5 75% 68%);
}

.composer__spacer { flex: 1; }

/* Context usage, sized to sit quietly beside the model button. */
.context-pill {
  position: relative;
  overflow: hidden;
  padding: 3px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

/* A quiet fill behind the numbers, so the ratio reads without a separate bar. */
.context-pill::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  background: var(--text-faint);
  opacity: 0.18;
}

.context-pill[data-level='warn'] { color: hsl(38 80% 66%); }
.context-pill[data-level='warn']::before { background: hsl(38 80% 66%); }
.context-pill[data-level='danger'] { color: hsl(5 75% 70%); }
.context-pill[data-level='danger']::before { background: hsl(5 75% 70%); }

/* Attachments ----------------------------------------------------------- */

/* Sits above the composer and shares its column, like the queue does. */
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: min(var(--content-width), 100%);
  margin: 0 auto 8px;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 3px 6px 3px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--bg-raised);
  font-size: 12px;
}

.attachment__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment__remove {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--text-faint);
}

.attachment__remove:hover { background: var(--bg-hover-strong); color: var(--text); }

/* Queued messages ------------------------------------------------------- */

/*
 * A queued message is drawn as the user bubble it is about to become, so the
 * only difference the eye has to catch is that it has not been sent yet.
 */
.queue {
  /* Identical geometry to .turn, so a queued bubble lines up with a sent one. */
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
  width: min(var(--content-width), calc(100% - 56px));
  margin: 0 auto 14px;
}

.queue-item {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.queue-item__bubble {
  max-width: 82%;
  padding: 11px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.queue-item__badge {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-hover-strong);
  color: var(--text-faint);
  font-size: 11px;
}

.queue-item__input {
  max-width: 82%;
  width: 82%;
  padding: 11px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: inherit;
}

/* Actions stay quiet until the row is worth acting on. */
.queue-item__actions {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.queue-item:hover .queue-item__actions,
.queue-item:focus-within .queue-item__actions { opacity: 1; }

.queue-item__btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-faint);
}

.queue-item__btn:hover { background: var(--bg-hover-solid); color: var(--text); }
.queue-item__btn:last-child:hover { color: hsl(5 70% 70%); }

.queue-item__interrupt {
  padding: 3px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.queue-item__interrupt:hover { background: var(--bg-hover-solid); color: var(--text); }

/* A drop target has to look like one the moment a drag enters. */
.composer.is-dropping {
  border-color: var(--accent);
  background: var(--bg-hover-solid);
}

/* Dragging anywhere over the app marks the composer as where it will land. */
.app.is-drop-target { outline: 2px dashed var(--accent); outline-offset: -8px; }
