/* Keep history controls separate so opening a row never deletes it. */
.history-row { position: relative; margin-bottom: 6px; }
.history-row .history-item { margin-bottom: 0; padding-right: 43px; }
.history-delete {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.history-delete .icon { width: 16px; height: 16px; }
.history-delete:hover { color: #ffb49a; background: #a3351726; }
.btn.danger { background: #b33220; border-color: #b33220; color: #fff; }
.btn.danger:hover { background: #97281b; border-color: #97281b; }
[data-theme="light"] .history-delete { background: transparent; }
[data-theme="light"] .history-delete:hover { color: #a33517; background: #ffede6; }
[data-theme="light"] .btn.danger { background: #b33220; border-color: #b33220; color: #fff; }
[data-theme="light"] .btn.danger:hover { background: #97281b; border-color: #97281b; }
.history-open { display: none; }

@media(max-width:640px) {
  /* Absolute positioning uses the chat's bounds in both themes, independent of blur. */
  .chat-layout { position: relative; }
  .history-panel { position: absolute; inset: 0; border: 0; border-radius: inherit; }
  .history-head { padding: 18px 16px; }
  .history-head .icon-btn { width: 44px; height: 44px; }
  .history-panel .history-list { overscroll-behavior: contain; touch-action: pan-y; }
  .history-delete { width: 44px; height: 44px; right: 2px; }
  .history-row .history-item { padding-right: 49px; min-height: 72px; }
  .chat-header > .tag { display: none; }
  .chat-header .history-open { display: inline-flex; margin-left: auto; gap: 6px; min-height: 38px; padding: 8px 10px; font-size: 10px; flex: none; }
  .chat-header .history-open .icon { width: 16px; height: 16px; }
}
