/* Home and wish dialogs use the same surfaces and controls as the chat workspace. */
html .agent-form-dialog [hidden] { display: none !important; }
html .agent-form-edit :is(.agent-home-progress, .agent-home-next, .agent-home-back) { display: none !important; }
html .agent-form-dialog {
  --form-gutter: clamp(1.1rem, 3vw, 2rem);
  width: min(46rem, calc(100vw - 2rem));
  max-width: none;
  height: fit-content;
  max-height: min(90dvh, 56rem);
  margin: auto;
  border: 1px solid var(--color-line-strong);
  border-radius: 1.1rem;
  color: var(--agent-ink);
  background: var(--color-surface);
  box-shadow: 0 20px 64px rgb(0 0 0 / .22);
  overflow: hidden;
}
html .agent-form-dialog::backdrop { background: rgb(8 20 25 / .54); }
html .agent-form-dialog .agent-dialog-header {
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem var(--form-gutter) 1.2rem;
}
html .agent-form-dialog .agent-dialog-header h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  line-height: 1.3;
  letter-spacing: -.025em;
  font-weight: 600;
}
html .agent-form-dialog .agent-dialog-header button {
  flex: 0 0 2.75rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: -.35rem;
  border: 1px solid var(--agent-line);
  border-radius: .65rem;
  color: var(--agent-ink);
  background: var(--color-surface);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
}
html .agent-form-dialog .agent-dialog-header .agent-form-description {
  margin: .6rem 0 0;
  color: var(--color-muted);
  font-size: .9rem;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: normal;
  text-transform: none;
}
html .agent-form-dialog .agent-home-progress {
  padding: 0 var(--form-gutter) 1rem;
  color: var(--color-muted);
  font-size: .8rem;
  font-weight: 600;
}
html .agent-form-dialog .agent-home-progress > div { height: 3px; margin-top: .75rem; background: var(--agent-line); }
html .agent-form-dialog .agent-home-progress i { background: var(--agent-accent); }
html .agent-form-dialog .agent-home-required-note {
  flex: 0 0 auto;
  margin: 0 var(--form-gutter) 1.2rem;
  color: var(--color-muted);
  font-size: .78rem;
}
html .agent-form-dialog .agent-home-form { flex: 0 1 auto; }
html .agent-form-dialog .agent-home-scroll { flex: 0 1 auto; padding: .2rem var(--form-gutter) 1.5rem; }
html .agent-form-dialog .agent-home-step { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem 1rem; }
html .agent-form-dialog .agent-home-step > header { margin-bottom: .25rem; }
html .agent-form-dialog .agent-home-step h3 { font-size: 1rem; font-weight: 600; }
html .agent-form-dialog .agent-home-step header p,
html .agent-form-dialog .agent-form-help { color: var(--color-muted); font-size: .84rem; line-height: 1.5; }
html .agent-form-dialog :is(.agent-home-field, .agent-wish-form label) {
  min-width: 0;
  gap: .5rem;
  color: var(--agent-ink);
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.45;
}
html .agent-form-dialog .agent-home-field legend { margin-bottom: .65rem; }
html .agent-form-dialog :is(.agent-home-field, .agent-wish-form) :is(input:not([type="radio"]):not([type="checkbox"]), select, textarea) {
  min-height: 3rem;
  padding: .75rem .85rem;
  border: 1px solid var(--color-line-strong);
  border-radius: .65rem;
  color: var(--agent-ink);
  background: var(--color-surface-strong);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: none;
}
html .agent-form-dialog input::placeholder { color: var(--color-muted); opacity: 1; }
html .agent-form-dialog :is(button, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--agent-accent);
  outline-offset: 3px;
}
html .agent-form-dialog :is(.agent-home-field, .agent-wish-form) :is(input, select, textarea):focus {
  border-color: var(--agent-accent);
  box-shadow: none;
}
html .agent-form-dialog :is(.agent-home-chips, .agent-home-options) { gap: .5rem; }
html .agent-form-dialog :is(.agent-home-chips, .agent-home-options) span {
  min-height: 2.75rem;
  padding: .65rem .85rem;
  border: 1px solid var(--color-line-strong);
  border-radius: .65rem;
  color: var(--agent-ink);
  background: var(--color-surface);
  font-size: .86rem;
  font-weight: 550;
}
html .agent-form-dialog :is(.agent-home-chips, .agent-home-options) input:checked + span {
  border-color: var(--agent-accent);
  color: var(--agent-ink);
  background: var(--color-surface-strong);
  box-shadow: inset 0 0 0 1px var(--agent-accent);
}
html .agent-form-dialog :is(.agent-home-chips, .agent-home-options) input:focus-visible + span {
  outline: 2px solid var(--agent-accent);
  outline-offset: 3px;
}
html .agent-form-dialog :is(.agent-home-check, .agent-home-upload, .agent-home-visibility-options span) {
  border: 1px solid var(--agent-line);
  border-radius: .75rem;
  color: var(--agent-ink);
  background: var(--color-surface-strong);
  padding: 1rem;
}
html .agent-form-dialog .agent-home-upload { border-style: dashed; min-height: 6rem; }
html .agent-form-dialog :is(.agent-home-check, .agent-home-upload, .agent-home-field, .agent-home-visibility-options) small {
  color: var(--color-muted);
  font-size: .8rem;
  font-weight: 400;
  line-height: 1.5;
}
html .agent-form-dialog .agent-home-upload strong { color: var(--agent-ink); }
html .agent-form-dialog .agent-home-visibility-options { grid-template-columns: 1fr; }
html .agent-form-dialog .agent-home-visibility-options span { min-height: 0; padding: .9rem 1rem; }
html .agent-form-dialog .agent-home-visibility-options strong { font-size: .9rem; font-weight: 600; }
html .agent-form-dialog .agent-home-visibility-options input:checked + span {
  border-color: var(--agent-accent);
  background: var(--color-surface-strong);
  box-shadow: inset 0 0 0 1px var(--agent-accent);
}
html .agent-form-dialog :is(.agent-home-optional, .agent-wish-form details, [data-home-showing-details]) {
  border: 1px solid var(--agent-line);
  border-radius: .75rem;
  padding: 1rem;
  background: var(--color-surface);
}
html .agent-form-dialog summary { min-height: 1.5rem; color: var(--agent-ink); font-size: .88rem; font-weight: 600; line-height: 1.5; }
html .agent-form-dialog .agent-wish-form details summary { margin-bottom: 0; }
html .agent-form-dialog .agent-wish-form details[open] summary { margin-bottom: .3rem; }
html .agent-form-dialog :is(.agent-home-actions, .agent-form-actions) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
  margin: 0;
  padding: 1rem var(--form-gutter);
  border-top: 1px solid var(--agent-line);
  background: var(--color-surface);
}
html .agent-form-dialog :is(.agent-home-actions, .agent-form-actions) button {
  min-height: 2.9rem;
  padding: .7rem 1.1rem;
  border: 1px solid var(--color-line-strong);
  border-radius: .65rem;
  color: var(--agent-ink);
  background: var(--color-surface-strong);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.4;
}
html .agent-form-dialog :is(.agent-home-next, .agent-home-save, .agent-form-actions button[type="submit"]) {
  border-color: var(--button-primary-border);
  color: var(--button-primary-text);
  background: var(--button-primary-background);
}
html .agent-form-dialog button:hover:not(:disabled) { border-color: var(--agent-accent); }
html .agent-form-dialog button:disabled { cursor: default; opacity: .55; }
html .agent-form-dialog :is(.agent-wish-error, .agent-home-error) {
  color: var(--color-danger);
  background: var(--color-surface-strong);
  border-inline-start: 3px solid var(--color-danger);
  border-radius: .35rem;
  padding: .75rem 1rem;
  font-size: .88rem;
  line-height: 1.5;
}
html .agent-form-dialog .agent-home-edit-nav { flex: 0 0 auto; padding: 0 var(--form-gutter) 1rem; gap: .45rem; }
html .agent-form-dialog .agent-home-edit-nav button { border-radius: .55rem; font-size: .8rem; }
html .agent-form-dialog .agent-wish-form {
  flex: 0 1 auto;
  gap: 1.2rem 1rem;
  padding: .25rem var(--form-gutter) 0;
  scrollbar-gutter: stable;
}
html .agent-form-dialog .agent-wish-visibility-note { color: var(--color-muted); font-size: .8rem; line-height: 1.6; }
html .agent-form-dialog .agent-form-actions {
  position: sticky;
  bottom: 0;
  grid-column: 1 / -1;
  margin-inline: calc(-1 * var(--form-gutter));
  z-index: 1;
}
html .agent-form-dialog .agent-home-review div { border-bottom: 1px solid var(--agent-line); padding-block: .7rem; }
@media (max-width: 620px) {
  html .agent-form-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - max(1rem, env(safe-area-inset-top)) - max(1rem, env(safe-area-inset-bottom)));
    border-radius: 1rem;
  }
  html .agent-form-dialog .agent-dialog-header { padding-top: 1.2rem; }
  html .agent-form-dialog .agent-home-step { grid-template-columns: minmax(0, 1fr); }
  html .agent-form-dialog :is(.agent-home-actions, .agent-form-actions) { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
  html .agent-form-dialog .agent-wish-form { grid-template-columns: minmax(0, 1fr); }
  html .agent-form-dialog .agent-home-edit-nav { flex-wrap: wrap; }
  html .agent-form-dialog .agent-home-edit-nav button { flex: 1 1 calc(50% - .5rem); }
}

/* Viewing changes use the same controls as the housing forms. */
.agent-overview [data-showing-change-form] { display: grid; gap: .75rem; margin-top: 1rem; }
.agent-overview [data-showing-change-form] :is(label, legend) { display: block; font-weight: 600; margin-bottom: .35rem; }
.agent-overview [data-showing-change-form] :is(input, select, textarea) { width: 100%; min-width: 0; box-sizing: border-box; padding: .7rem; border: 1px solid var(--color-line-strong); border-radius: .65rem; color: var(--agent-ink); background: var(--color-surface-strong); font: inherit; font-size: 1rem; }
.agent-overview [data-showing-change-form] textarea { resize: vertical; }
.agent-overview [data-showing-change-form] fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.agent-overview [data-showing-change-form] fieldset label { margin-top: .75rem; }
.agent-overview [data-showing-change-form] [hidden] { display: none !important; }
.agent-overview [data-showing-change-form] :is(input, select, textarea):focus-visible { outline: 2px solid var(--agent-accent); outline-offset: 2px; }
.agent-overview :is([data-showing-change-form] button, [data-open-cancel-showing]) { min-height: 2.75rem; padding: .65rem .9rem; border: 1px solid var(--color-line-strong); border-radius: .65rem; color: var(--agent-ink); background: var(--color-surface-strong); font: inherit; font-weight: 600; cursor: pointer; }
.agent-overview [data-showing-change-form] button:disabled { opacity: .6; cursor: wait; }
.agent-overview [data-showing-change-form] button:focus-visible { outline: 2px solid var(--agent-accent); outline-offset: 2px; }
