/* ---------- Memory settings page (PRD §12.7) ---------- */

.settings-page {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-7) 0 var(--space-6);
}

.settings-page__title { margin: 0 0 var(--space-6); font-size: var(--text-2xl); }

.settings-section { margin-bottom: var(--space-7); }
.settings-section__head { margin-bottom: var(--space-3); }
.settings-section__head h2 { margin: 0; font-size: var(--text-base); color: var(--color-heading); }
.settings-section__head p { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }

.settings-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-raised);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--color-border);
}

.settings-row:first-child { border-top: 0; }
.settings-row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-row__text strong { font-weight: 500; color: var(--color-heading); overflow-wrap: anywhere; }
.settings-row__text > span { font-size: var(--text-sm); color: var(--color-text-muted); overflow-wrap: anywhere; }
.settings-row__control { flex: none; margin: 0; }

/* An on/off switch drawn from a checkbox. */
.switch {
  appearance: none;
  position: relative;
  width: 42px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--color-border-strong);
  cursor: pointer;
  transition: background 150ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: transform 150ms ease;
}

.switch:checked { background: var(--color-primary); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
.switch:focus { outline: none; border: 0; }
.switch:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 2px; }

.btn-quiet-danger {
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
  color: var(--color-danger-fg);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.btn-quiet-danger:hover:not(:disabled) { filter: brightness(0.97); }
.btn-quiet-danger:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 640px) {
  .settings-page { padding-inline: var(--space-4); }
}

/* A note the agent saved, under its reply in Chat. */
.chat-memory-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.chat-memory-note span { flex: 1 1 auto; min-width: 0; }
.chat-memory-note.is-archived span { text-decoration: line-through; }
.chat-memory-note form { display: inline; }

.chat-memory-note__undo,
.chat-memory-note__link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-primary);
  font: inherit;
  cursor: pointer;
}

.chat-memory-note__link { text-decoration: none; }
.chat-memory-note__undo:hover,
.chat-memory-note__link:hover { text-decoration: underline; }

